I am unable to skip the second row of a data file while reading a csv file in python.
I am using the following code :
imdb_data = pd.read_csv('IMDB_data.csv', encoding = "ISO-8859-1",skiprows = 2)
Your code will ommit the first two lines of your csv. If you want the second line to be ommitted (but the first one included) just do this minor change:
imdb_data = pd.read_csv('IMDB_data.csv', encoding = "ISO-8859-1",skiprows = [1])
Looking at the documentation we can learn that if you supply an integer n
for skiprows
, the first n
rows are skipped. If you want to skip single lines explicitly by line number (0 indexed), you must supply a list-like argument.
In your specific case, that would be skiprows=[1]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With