Pandas Dataframe 没有 Plot 功能 [英] Pandas Dataframe has no Plot function
问题描述
我正在尝试调用 df.plot.scatter(...)
,如图所示 此处,其中 df
是 pandas.Dataframe
对象.
I'm trying to call df.plot.scatter(...)
as shown here, where df
is a pandas.Dataframe
object.
但是当我提出建议时,我的 IDE 无法建议任何绘图功能(尽管它可以建议其他 dataframe
成员,例如 fillna()
、to_json()
等).
But my IDE can't suggest any plot function when I initiate suggestions (though it can suggest other dataframe
members like fillna()
, to_json()
etc).
如果我无论如何编写 df.plot.scatter(...)
并运行它,它会给出错误:
If I anyway write df.plot.scatter(...)
and run it, it gives error:
AttributeError: 'function' object has no attribute 'scatter'
我在 Windows 7 上使用 python 3.4.我的 IDE 是 PyCharm.这些是进口:
I use python 3.4 on windows 7. My IDE is PyCharm. These are the imports:
import pandas as pd
import matplotlib.pyplot as plt
可能是关于我的python版本,或者这个功能可能从pandas API中删除了?提前致谢.
Can it be about my python version, or maybe this function is removed from pandas API? Thanks in advance.
推荐答案
我认为你的 pandas
版本比 0.17.0
旧.
I think your pandas
version is older as 0.17.0
.
0.17.0 版的新功能.
New in version 0.17.0.
在旧版本中,您可以使用:
In older version you can use:
df.plot(kind='scatter')
这篇关于Pandas Dataframe 没有 Plot 功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!