Detail: HLoc: Constructor

Overview: HLoc: Constructor

HLoc.__init__(key)[source]
>>> ih = sf.IndexHierarchy.from_product(('a', 'b', 'c'), (1024, 4096, 2048), name='x')
>>> ih
<IndexHierarchy: x>
a                   1024
a                   4096
a                   2048
b                   1024
b                   4096
b                   2048
c                   1024
c                   4096
c                   2048
<<U1>               <int64>
>>> ih.loc[sf.HLoc[:, 4096]]
<IndexHierarchy: x>
a                   4096
b                   4096
c                   4096
<<U1>               <int64>
>>> ih.loc[sf.HLoc[['a', 'c'], [1024, 2048]]]
<IndexHierarchy: x>
a                   1024
a                   2048
c                   1024
c                   2048
<<U1>               <int64>
>>> f = sf.Frame.from_fields(((10, 2, 8, 3), (False, True, True, False), ('1517-01-01', '1517-04-01', '1517-12-31', '1517-06-30')), index=sf.IndexHierarchy.from_product((0, 1), ('p', 'q')), columns=('a', 'b', 'c'), dtypes=dict(c=np.datetime64), name='x')
>>> f
<Frame: x>
<Index>                a       b      c               <<U1>
<IndexHierarchy>
0                p     10      False  1517-01-01
0                q     2       True   1517-04-01
1                p     8       True   1517-12-31
1                q     3       False  1517-06-30
<int64>          <<U1> <int64> <bool> <datetime64[D]>
>>> f.loc[sf.HLoc[:, 'q']]
<Frame: x>
<Index>                a       b      c               <<U1>
<IndexHierarchy>
0                q     2       True   1517-04-01
1                q     3       False  1517-06-30
<int64>          <<U1> <int64> <bool> <datetime64[D]>

HLoc: Constructor | Attribute | Method | Dictionary-Like | Display