2016-08-02 34 views
0

我有低于这个CSV数据:不能打电话的时间数据在python

2015-01-02,02:29:45 PM,Red 
2015-01-02,05:16:15 PM,Red 
2015-01-02,05:48:46 PM,Blue 
2015-01-02,03:18:34 PM,Blue 
2015-01-02,05:22:55 PM,Red 
2015-01-02,03:25:45 PM,Blue 
2015-01-02,04:23:16 PM,Red 

我试图使用matplotlib 这些数据绘制成曲线图,其中x轴=日期,y轴=时间值=红色或蓝色的点 但是,我越来越想呼叫的时间栏时,这个错误:

time = df('Time') 
print (time.head()) 
**DataFrame' object is not callable** 

但如果我所说的日期栏,它工作正常:

date = df['Date'] 
print (date.head()) 

0 2015-01-02 
1 2015-01-02 
2 2015-01-02 
3 2015-01-02 
4 2015-01-02 
Name: Date, dtype: datetime64[ns] 
+1

也许把你的代码放在阴谋...... – bernie

回答

0
time = df['Time'] 

当访问熊猫数据框中的列时,使用[]而不是()

+0

惊人的问题。新手在这里。谢谢。 :) –

+0

不用担心。此外,给予upvote。 – hd1