Python Forum
Auto-headers disable in importing CSV files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto-headers disable in importing CSV files
#1
#phython3

Hi when I import my .csv file, it automatically makes my 1st row into headers which is wrong for I do not really have headers for my file. How can I correct this when importing? TIA
Reply
#2
what library do you use? csv, pandas, something else?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
Im using pandas

import pandas as pd
sample_data = pd.read_csv('myfile.csv')
Reply
#4
RTM
pandas doc,
see header and names arguments
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sum product multiple Dataframes based on column headers. Lastwizzle 0 3,807 May-21-2019, 04:05 PM
Last Post: Lastwizzle
  Python QtableWidget get text of all cells and headers to dataframe Mady 3 23,037 Dec-15-2018, 06:46 PM
Last Post: Axel_Erfurt
  Add column headers to dataframe chisox721 5 8,720 May-20-2018, 12:31 AM
Last Post: volcano63
  Read CSV Files with multiple headers into Python DataFrame UGuntupalli 12 26,590 Jan-26-2017, 03:07 PM
Last Post: UGuntupalli

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020