【发布时间】:2013-09-18 20:15:47
【问题描述】:
我正在关注 Wes McKinney 的一本书,在介绍 pandas 的部分中,他给出了一个绘制 pandas 数据框的简单示例。这是我写的几行:
tz_counts = frame['tz'].value_counts() # frame is a Data Frame
tz_counts[:10] # works fine till here. I can see the key-value I wanted
tz_counts[:10].plot(kind='barh', rot=0)
它只是在屏幕上打印一行,上面写着
<matplotlib.axes.AxesSubplot object at 0x3d14ed0>
而不是像我期望的那样使用 matplotlib 的绘图功能显示绘图窗口。这里有什么问题?我怎样才能让它发挥作用?
【问题讨论】:
-
你是如何开始 IPython 的?你跑
ipython --pylab了吗?如果您刚刚做了ipython,那么您将得到您所报告的内容。 -
即使它无关紧要,如果您安装了 qtconsole,我建议运行“ipython qtconsole --pylab inline”。我个人觉得这样更合适。
-
我不知道“便携”是一个词。
-
@PhillipCloud 这只是一个错字,我的意思是舒适。
标签: python matplotlib plot pandas