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
<IndexHierarchy: x>
a                   1024    True
a                   2048    True
a                   2048    False
b                   1024    True
<<U1>               <int64> <bool>
>>> 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]
iloc
>>> ih = sf.IndexHierarchy.from_labels((('a', 1024, True), ('a', 2048, True), ('a', 2048, False), ('b', 1024, True)), name='x')
>>> ih
<IndexHierarchy: x>
a                   1024    True
a                   2048    True
a                   2048    False
b                   1024    True
<<U1>               <int64> <bool>
>>> 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]
loc
>>> ih = sf.IndexHierarchy.from_labels((('a', 1024, True), ('a', 2048, True), ('a', 2048, False), ('b', 1024, True)), name='x')
>>> ih
<IndexHierarchy: x>
a                   1024    True
a                   2048    True
a                   2048    False
b                   1024    True
<<U1>               <int64> <bool>
>>> 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 | Accessor Type Clinic