pd.read_csv分析错误

时间:2018-09-14 16:04:27

标签: python pandas csv

我有一个如下所示的CSV文件:

Date,Time,Mood,Tags,Medications,Notes
"Jul 25, 2018",9:41 PM,8,,,"",
"Jul 26, 2018",10:05 AM,4,,,"",
"Jul 26, 2018",12:00 PM,3,,,"",
"Jul 26, 2018",7:00 PM,8,,,"",
"Jul 27, 2018",12:01 PM,8,,,"",

我运行以下代码:

import pandas as pd

df = pd.read_csv("./data/MoodLog_2018_09_14.csv", 
                 dtype={'Date': str, 'Time': str, 'Mood': str, 'Tags': str, 
                        'Medications': str, 'Notes': str})

print(df['Time'].head(5))

并显示以下内容:

Jul 25, 2018    8
Jul 26, 2018    4
Jul 26, 2018    3
Jul 26, 2018    8
Jul 27, 2018    8
Name: Time, dtype: object

它包括Mood列中的Time列。

那是为什么?

0 个答案:

没有答案