Python VALUETERROR在将datetime转换为int时出错

Python VALUETERROR在将datetime转换为int时出错,python,pandas,Python,Pandas,我试图将开始时间转换为int,将其添加到数据帧中,然后绘制散点图 test_df['Start'] = test_df['start'].astype(np.int64) icma_df.plot.scatter(x='Start', y='marks').convert_objects(convert_numeric=True) 上面的代码给出了以下错误 ValueError: invalid literal for int() with base 10: '29 Jan 2016 06:

我试图将开始时间转换为int,将其添加到数据帧中,然后绘制散点图

test_df['Start'] = test_df['start'].astype(np.int64)
icma_df.plot.scatter(x='Start', y='marks').convert_objects(convert_numeric=True)
上面的代码给出了以下错误

ValueError: invalid literal for int() with base 10: '29 Jan 2016  06:56'

'2016年1月29日06:56'
不是熊猫/numpy日期时间,而是字符串。首先将您的
'start'
转换为带有
pd.to\u datetime
的日期时间。

代码有多重要。将第二行末尾的对象(Convert\u numeric=True)转换为不带此项的对象我不会出错,否则我会出错。以下一个AttributeError:“AxeSubplot”对象没有属性“convert_objects”convert_对象应用于数据帧,而不是针对plot.scatter返回的AxeSubplot。请相信您从解释器收到的错误消息,python擅长于此:它用简单的英语告诉您,您试图对没有此方法的AxesSubplot对象调用convert_对象。