Python 数据帧散点图上的键错误
我正试图打印df中纬度和经度值的散点图。运行此操作时:Python 数据帧散点图上的键错误,python,pandas,dataframe,jupyter-notebook,Python,Pandas,Dataframe,Jupyter Notebook,我正试图打印df中纬度和经度值的散点图。运行此操作时: info.plot.scatter(x=info['latitude'], y=info['longitude']) 我得到以下关键错误 KeyError: "None of [Float64Index([ 34.6951242, 34.6951242, 34.6951242,\n 34.6951242, 35.6580681
info.plot.scatter(x=info['latitude'], y=info['longitude'])
我得到以下关键错误
KeyError: "None of [Float64Index([ 34.6951242, 34.6951242, 34.6951242,\n 34.6951242, 35.6580681, 35.6580681,\n 35.6580681, 35.6580681, 35.6580681,\n 35.6580681,\n ...\n 35.7511648, 35.7511648, 35.6940027,\n 35.6940027, 35.6617773, 35.6617773,\n 35.6617773, 35.6617773, 43.055460100000005,\n 43.055460100000005],\n dtype='float64', length=829)] are in the [columns]"
当我打印尾部时,df看起来是正确的。有人知道发生了什么吗?放弃
信息内部分散:
info.plot.scatter(x='latitude', y='longitude')
plt.scatter(x=info['latitude'], y=info['longitude'])
或者使用plt.scatter
:
info.plot.scatter(x='latitude', y='longitude')
plt.scatter(x=info['latitude'], y=info['longitude'])