Detail: IndexHierarchy: SelectorΒΆ

Overview: IndexHierarchy: Selector

IndexHierarchy[key]
IndexHierarchy.__getitem__ = <function IndexHierarchy.__getitem__>[source]
>>> ih = sf.IndexHierarchy.from_labels((('a', 1024, True), ('a', 2048, True), ('a', 2048, False), ('b', 1024, True)), name='x')
>>> ih[2]
('a', 2048, False)
>>> ih[2:]
<IndexHierarchy: x>
a                   2048    False
b                   1024    True
<<U1>               <int64> <bool>
>>> ih[[0, 3]]
<IndexHierarchy: x>
a                   1024    True
b                   1024    True
<<U1>               <int64> <bool>
IndexHierarchy.iloc[key]
IndexHierarchy.iloc
>>> ih = sf.IndexHierarchy.from_labels((('a', 1024, True), ('a', 2048, True), ('a', 2048, False), ('b', 1024, True)), name='x')
>>> ih.iloc[2]
('a', 2048, False)
>>> ih.iloc[2:]
<IndexHierarchy: x>
a                   2048    False
b                   1024    True
<<U1>               <int64> <bool>
>>> ih.iloc[[0, 3]]
<IndexHierarchy: x>
a                   1024    True
b                   1024    True
<<U1>               <int64> <bool>
IndexHierarchy.loc[key]
IndexHierarchy.loc
>>> ih = sf.IndexHierarchy.from_labels((('a', 1024, True), ('a', 2048, True), ('a', 2048, False), ('b', 1024, True)), name='x')
>>> ih.loc[('a', 2048, True)]
('a', 2048, True)
>>> ih.loc[('a', 2048, True):]
<IndexHierarchy: x>
a                   2048    True
a                   2048    False
b                   1024    True
<<U1>               <int64> <bool>
>>> ih.loc[[('a', 2048, True), ('b', 1024, True)]]
<IndexHierarchy: x>
a                   2048    True
b                   1024    True
<<U1>               <int64> <bool>

IndexHierarchy: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Regular Expression | Accessor Hashlib