熊猫按多个位置选择索引元素

时间:2020-12-20 21:08:28

标签: python pandas

这是 R 中的一件小事,但在 python pandas 中对我来说似乎很困惑。如何按多个位置对“索引”进行子集。

import pandas as pd
unique_index = pd.Index(list('abcdefg'))
#- Not working, I only want 0 and 2.
unique_index[0, 2]
#- or dont want 0, 2; also not working
unique_index[-0, -2]

非常感谢。

0 个答案:

没有答案