Python df.plot.scatter失败,但df.plot生成绘图

Python df.plot.scatter失败,但df.plot生成绘图,python,pandas,python-2.7,dataframe,plot,Python,Pandas,Python 2.7,Dataframe,Plot,我想从下面的示例中生成数据的散点图。 我可以使用以下工具生成线条图: ax = df_stats.plot(x = 't', y = 't_TI_var_ws') ax1 = ax.twinx() df_stats.plot(x='t',y='t_TI_var_pwr',ax=ax1, color='g') 但是当我尝试使用.scatter绘制与散点图相同的数据时,我得到了错误keyrorm:'t' ax = df_stats.plot.scatter(x = 't', y = 't_TI_

我想从下面的示例中生成数据的散点图。 我可以使用以下工具生成线条图:

ax = df_stats.plot(x = 't', y = 't_TI_var_ws')
ax1 = ax.twinx()
df_stats.plot(x='t',y='t_TI_var_pwr',ax=ax1, color='g')

但是当我尝试使用
.scatter
绘制与散点图相同的数据时,我得到了错误
keyrorm:'t'

ax = df_stats.plot.scatter(x = 't', y = 't_TI_var_ws')
ax1 = ax.twinx()
df_stats.plot.scatter(x='t',y='t_TI_var_pwr',ax=ax1, color='g')

您的列to似乎是一个时间戳。要使用“散布”,它必须是一个浮点。 可以使用以下工具绘制散点图:

ax = df_stats.plot(x = 't', y='t_TI_var_pwr',style='o')      

如果您这样做会发生什么:
df_stats.plot(x='t',y='t't'TI'u var\u pwr',ax=ax1,color='g',kind='scatter')
相同的错误
KeyError:'t'
请提供示例data@YOLO
type('t')
返回
'str'
t
在变量浏览器中列为
datetime