My CSV File: (Between Monday, Tuesday and Wednesday are empty cell blocks)
Monday Tuesday Wednesday
Items Price Items Price Items Price
Mon 1 Tues 1 Wed 1
Mon2 2 Tues2 2 Wed2 2
How can I read a specific table?
The outcome that I want:
df['Monday']
>>
Items Price
Mon 1
Mon2 2
df['Tuesday']['Items'].values()
>>
['Tues', 'Tues2']
Is this possible?
If you are using.read_csv of pandas you can specify the column header
#exemple file 2 lines of headers:
df=pd.read_csv('filename', header=[0, 1])
Source: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.