Home > OS >  Finding header of CSV file with pandas
Finding header of CSV file with pandas

Time:07-18

Is there any easy way to store the values of a CSV file's header? I've been researching but I can't find any info about it.

CodePudding user response:

this should work

df = pd.read_csv(path to file)
df.columns = list(df)  # to put header inside data frame 
print(df)
var = list(df.columns) # to read header from data frame
  • Related