Pandas panelnd 与具有分层索引的数据框 [英] Pandas panelnd vs dataframe with hierarchical index

查看:55
本文介绍了Pandas panelnd 与具有分层索引的数据框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道何时以及为什么我应该更喜欢面板(nd)而不是具有分层索引的数据框,反之亦然.在我非常简短的经验中,我会说前者更便于切片,而后者用于数学运算.我的特别需要是通过方便的切片和元素操作以交互方式操作 3-5 维面板.

I was wondering when and why I should prefer a panel(nd) over a dataframe with hierarchical index, and vice versa. In my very brief experience, I would say that the former is more convenient for slicing, while the latter for mathematical operations. My particular need would be to interactively manipulate 3-5 dimensional panels with convenient slicing and element-wise operations.

谢谢,

贾科莫

推荐答案

通常坚持使用多索引框架,因为它们得到更全面的支持.

Generally stick with a multi-indexed frame as they are more fully supported.

A panelnd 就像一个广义的 n-dim Panel,主要适用于单一类型的数据.它确实像面板一样工作,但有一些怪癖和缺失的功能(这就是为什么它是实验性的).

A panelnd is like a generalized n-dim Panel, good mainly for single-dtyped data. It does work like a Panel, but has some quirks and missing features (its why its experimental).

他们的将一些操作应用于n-dim的多个slab的方法(特别是通过0.13.1中的新apply,参见此处.

Their are ways to apply some operations to multiple slabs of a n-dim (esp. via new apply in 0.13.1, see here.

一旦我达到 3 维以上,我主要是保存"数据并切片以在 2 维中工作,然后在需要时重新组装它.对于这些更高亮度的对象(例如,通过 HDFStore),存储也很方便,这也是它们最初被创建的原因.

Once I get to more than 3 dimensions, I mainly 'hold' the data and slice to work it in 2 dimensions, then reassemble it if needed. Storage can also be convient for these higher dim objects (e.g. via HDFStore), and was the reason they were created in the first place.

这篇关于Pandas panelnd 与具有分层索引的数据框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆