相关疑难解决方法(0)

从多指数熊猫中选择

我有一个带有"A"和"B"列的多索引数据框.

是否有一种方法可以通过过滤多索引的一列来选择行,而无需将索引重置为单列索引.

例如.

# has multi-index (A,B)
df
#can I do this? I know this doesn't work because the index is multi-index so I need to     specify a tuple

df.ix[df.A ==1]
Run Code Online (Sandbox Code Playgroud)

python multi-index dataframe pandas

77
推荐指数
7
解决办法
9万
查看次数

标签 统计

dataframe ×1

multi-index ×1

pandas ×1

python ×1