Make a note of how to read the csv file
Check with a simple one like the one above
import pandas as pd
data = pd.read_csv('csv file path/file name.csv')
print(data)
The csv file is read in the first line and displayed in the second line. The following is displayed
print(data.columns)
When I run the above code, I get the following header information
The first line of the csv file is recognized as a header
data = pd.read_csv('csv file path/file name.csv',header=None)
print(data)
The header of 0 1 2 3 4 is set separately from the contents of the csv file.
data = pd.read_csv('csv file path/file name.csv',names=('A','B','C','D','E'))
print(data)
The specified A B C D E is set as the header.
Csv file used
data = pd.read_csv('csv file path/file name.csv',names=('A','B','C','D','E'),index_col=0, parse_dates=True))
print(data)
print(data.index)
index is recognized as datetime.
Recommended Posts