Detail: Batch: Accessor Reduce

Overview: Batch: Accessor Reduce

Batch.reduce.from_func(func, *, fill_value)
Batch.reduce

Return a ReduceAligned interface, permitting function application per column or on entire containers.

InterfaceBatchReduceDispatch.from_func(func, *, fill_value=nan)[source]
>>> 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
<Batch max_workers=None>
>>> bt.reduce.from_func(lambda f: f.iloc[1:]).to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                q     2       3
i                r     4       5
j                q     42      43
j                r     44      45
<<U1>            <<U1> <int64> <int64>
Batch.reduce.from_map_func(func, *, fill_value)
Batch.reduce

Return a ReduceAligned interface, permitting function application per column or on entire containers.

InterfaceBatchReduceDispatch.from_map_func(func, *, fill_value=nan)[source]
>>> 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
<Batch max_workers=None>
>>> bt.reduce.from_map_func(np.min).to_frame()
<Frame>
<Index>                a       b       <<U1>
<IndexHierarchy>
i                x     0       1
j                v     40      41
<<U1>            <<U1> <int64> <int64>
Batch.reduce.from_label_map(func_map, *, fill_value)
Batch.reduce

Return a ReduceAligned interface, permitting function application per column or on entire containers.

InterfaceBatchReduceDispatch.from_label_map(func_map, *, fill_value=nan)[source]
>>> 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
<Batch max_workers=None>
>>> bt.reduce.from_label_map({'b': np.min, 'a': np.max}).to_frame()
<Frame>
<Index>                b       a       <<U1>
<IndexHierarchy>
i                x     1       4
j                v     41      44
<<U1>            <<U1> <int64> <int64>
Batch.reduce.from_label_pair_map(func_map, *, fill_value)
Batch.reduce

Return a ReduceAligned interface, permitting function application per column or on entire containers.

InterfaceBatchReduceDispatch.from_label_pair_map(func_map, *, fill_value=nan)[source]
>>> 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
<Batch max_workers=None>
>>> bt.reduce.from_label_pair_map({('b', 'b-min'): np.min, ('b', 'b-max'): np.max}).to_frame()
<Frame>
<Index>                b-min   b-max   <<U5>
<IndexHierarchy>
i                x     1       5
j                v     41      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 | Accessor Reduce