【问题标题】:Ploting pandas panel across one dimension在一维上绘制熊猫面板
【发布时间】:2012-11-14 22:14:50
【问题描述】:

我有一个数据面板,我想分割数据来绘制它。

例如。次要维度上的切片。数据是

<class 'pandas.core.panel.Panel'>
Dimensions: 71 (items) x 192 (major) x 19 (minor)
Items: gain to gain_delta
Major axis: AFG to ZWE
Minor axis: ISO3 to 2011

所以如果我想绘制这个切片:

scores.ix[['gain'],['ESP'],2:21]

给予

<bound method Panel.to_frame of <class 'pandas.core.panel.Panel'>
Dimensions: 1 (items) x 1 (major) x 17 (minor)
Items: gain to gain
Major axis: ESP to ESP
Minor axis: 1995 to 2011>

但这些都会出错:

scores.ix[['gain'],['ESP'],2:21].plot()

scores.ix[['gain'],['ESP'],2:21].to_frame.plot()

a=scores.ix[['gain'],['ESP'],2:21]
plot(a)

谢谢!

【问题讨论】:

    标签: python pandas


    【解决方案1】:

    我认为您不能绘制面板。

    要从面板中提取系列(和绘图),您可以使用ix,语法如下:

    scores.ix['gain', 'ESP', 2:21].plot()
    

    【讨论】:

      猜你喜欢
      • 2015-11-13
      • 1970-01-01
      • 2017-06-08
      • 2016-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-16
      相关资源
      最近更新 更多