Detail: Batch: Selector

Overview: Batch: Selector

Batch.bloc[key]
bloc
>>> bt = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt.bloc[np.arange(6).reshape(3,2) >= 3].to_frame()
<Frame>
<Index> ('q', 'b') ('r', 'a') ('r', 'b') <object>
<Index>
i       3          4          5
j       43         44         45
<<U1>   <int64>    <int64>    <int64>
Batch.drop[key]
drop
InterfaceSelectTrio.__getitem__(key)[source]

Label-based selection.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x')), ('j', sf.Frame.from_fields(((0, 0, 10, 2), (20, 18, -3, 18), (0, 0, 0, 1)), columns=('a', 'b', 'c'), name='x'))))
>>> bt.drop['b'].to_frame()
<Frame>
<Index>                  a       c       <<U1>
<IndexHierarchy>
i                0       11      0
i                1       4       1
i                2       10      0
i                3       2       1
j                0       0       0
j                1       0       0
j                2       10      0
j                3       2       1
<<U1>            <int64> <int64> <int64>
>>> bt.drop['b':].to_frame()
<Frame>
<Index>                  a       <<U1>
<IndexHierarchy>
i                0       11
i                1       4
i                2       10
i                3       2
j                0       0
j                1       0
j                2       10
j                3       2
<<U1>            <int64> <int64>
>>> bt.drop[['a', 'c']].to_frame()
<Frame>
<Index>                  b       <<U1>
<IndexHierarchy>
i                0       0
i                1       8
i                2       3
i                3       8
j                0       20
j                1       18
j                2       -3
j                3       18
<<U1>            <int64> <int64>
Batch.drop.iloc[key]
Batch.drop
InterfaceSelectTrio.iloc

Integer-position based selection.

>>> bt = sf.Batch((('i', sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x')), ('j', sf.Frame.from_fields(((0, 0, 10, 2), (20, 18, -3, 18), (0, 0, 0, 1)), columns=('a', 'b', 'c'), name='x'))))
>>> bt.drop.iloc[1].to_frame()
<Frame>
<Index>                  a       b       c       <<U1>
<IndexHierarchy>
i                0       11      0       0
i                2       10      3       0
i                3       2       8       1
j                0       0       20      0
j                2       10      -3      0
j                3       2       18      1
<<U1>            <int64> <int64> <int64> <int64>
>>> bt.drop.iloc[1:].to_frame()
<Frame>
<Index>                  a       b       c       <<U1>
<IndexHierarchy>
i                0       11      0       0
j                0       0       20      0
<<U1>            <int64> <int64> <int64> <int64>
>>> bt.drop.iloc[[0, 2]].to_frame()
<Frame>
<Index>                  a       b       c       <<U1>
<IndexHierarchy>
i                1       4       8       1
i                3       2       8       1
j                1       0       18      0
j                3       2       18      1
<<U1>            <int64> <int64> <int64> <int64>
Batch.drop.loc[key]
Batch.drop
InterfaceSelectTrio.loc

Label-based selection.

>>> bt = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt.drop.loc['r'].to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     0       1
i                q     2       3
j                p     40      41
j                q     42      43
<<U1>            <<U1> <int64> <int64>
>>> bt.drop.loc['r':].to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     0       1
i                q     2       3
j                p     40      41
j                q     42      43
<<U1>            <<U1> <int64> <int64>
>>> bt.drop.loc[['p', 'q']].to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                r     4       5
j                r     44      45
<<U1>            <<U1> <int64> <int64>
Batch[key]()
Batch.__getitem__ = <function Batch.__getitem__>[source]
>>> bt = sf.Batch((('i', sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x')), ('j', sf.Frame.from_fields(((0, 0, 10, 2), (20, 18, -3, 18), (0, 0, 0, 1)), columns=('a', 'b', 'c'), name='x'))))
>>> bt['b'].to_frame()
<Frame>
<Index> 0       1       2       3       <int64>
<Index>
i       0       8       3       8
j       20      18      -3      18
<<U1>   <int64> <int64> <int64> <int64>
>>> bt['b':].to_frame()
<Frame>
<Index>                  b       c       <<U1>
<IndexHierarchy>
i                0       0       0
i                1       8       1
i                2       3       0
i                3       8       1
j                0       20      0
j                1       18      0
j                2       -3      0
j                3       18      1
<<U1>            <int64> <int64> <int64>
>>> bt[['a', 'c']].to_frame()
<Frame>
<Index>                  a       c       <<U1>
<IndexHierarchy>
i                0       11      0
i                1       4       1
i                2       10      0
i                3       2       1
j                0       0       0
j                1       0       0
j                2       10      0
j                3       2       1
<<U1>            <int64> <int64> <int64>
Batch.iloc[key]
iloc
>>> bt = sf.Batch((('i', sf.Frame.from_fields(((11, 4, 10, 2), (0, 8, 3, 8), (0, 1, 0, 1)), columns=('a', 'b', 'c'), name='x')), ('j', sf.Frame.from_fields(((0, 0, 10, 2), (20, 18, -3, 18), (0, 0, 0, 1)), columns=('a', 'b', 'c'), name='x'))))
>>> bt.iloc[2].to_frame()
<Frame>
<Index> a       b       c       <<U1>
<Index>
i       10      3       0
j       10      -3      0
<<U1>   <int64> <int64> <int64>
>>> bt.iloc[2:].to_frame()
<Frame>
<Index>                  a       b       c       <<U1>
<IndexHierarchy>
i                2       10      3       0
i                3       2       8       1
j                2       10      -3      0
j                3       2       18      1
<<U1>            <int64> <int64> <int64> <int64>
>>> bt.iloc[[0, 3]].to_frame()
<Frame>
<Index>                  a       b       c       <<U1>
<IndexHierarchy>
i                0       11      0       0
i                3       2       8       1
j                0       0       20      0
j                3       2       18      1
<<U1>            <int64> <int64> <int64> <int64>
Batch.loc[key]
loc
>>> bt = sf.Batch((('i', sf.Frame(np.arange(6).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='x')), ('j', sf.Frame(np.arange(40, 46).reshape(3,2), index=('p', 'q', 'r'), columns=('a', 'b'), name='v'))))
>>> bt.loc['r'].to_frame()
<Frame>
<Index> a       b       <<U1>
<Index>
i       4       5
j       44      45
<<U1>   <int64> <int64>
>>> bt.loc['r':].to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                r     4       5
j                r     44      45
<<U1>            <<U1> <int64> <int64>
>>> bt.loc[['p', 'r']].to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                p     0       1
i                r     4       5
j                p     40      41
j                r     44      45
<<U1>            <<U1> <int64> <int64>

Batch: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Transpose | Accessor Fill Value | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic