Skip to content
Advertisement

skip second row of dataframe while reading csv file in python

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) 

Advertisement

Answer

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]) 
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement