r/pythontips • • Nov 12 '24

Syntax Simple CSV help needed

So I really have no coding experience but im in a statistic computing class. So I have to import a csv file and use pandas and then show a report of the data with histograms, boxplots, etc. My data had a long header so the actual data doesnt start until row 55. I used skiprows to make it just read where it actually begins. My problem is that Its not reading the column names, so when i try to reference a specific column it just errors and says it doesnt recognize that column name. How do i make all the column names on row 55 recognized as column names?

3 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/polevault_king Nov 12 '24

thanks, what would i put in for the df.columns = columns located on 55th row

1

u/SupermarketOk6829 Nov 12 '24

Use loc or iloc after reading the file in dataframe.