Detail: Batch: Accessor Values
Overview: Batch: Accessor Values
- Batch.via_values.apply(func, *args, **kwargs)
- Batch.via_values
Interface for applying a function to values in this container.
- InterfaceBatchValues.apply(func, *args, **kwargs)[source]
Interface for using binary operators and methods with a pre-defined fill value.
>>> 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.via_values.apply(np.sin).to_frame() <Frame> <Index> a b <<U1> <IndexHierarchy> i p 0.0 0.8414709848078965 i q 0.9092974268256817 0.1411200080598672 i r -0.7568024953079282 -0.9589242746631385 j p 0.7451131604793488 -0.158622668804709 j q -0.9165215479156338 -0.8317747426285983 j r 0.017701925105413577 0.8509035245341184 <<U1> <<U1> <float64> <float64>
- Batch.via_values.__array_ufunc__(ufunc, method, *args, **kwargs)
- Batch.via_values
Interface for applying a function to values in this container.
- InterfaceBatchValues.__array_ufunc__(ufunc, method, *args, **kwargs)[source]
Support for applying NumPy functions directly on containers, returning NumPy arrays.
>>> 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> >>> np.sin(bt.via_values).to_frame() <Frame> <Index> a b <<U1> <IndexHierarchy> i p 0.0 0.8414709848078965 i q 0.9092974268256817 0.1411200080598672 i r -0.7568024953079282 -0.9589242746631385 j p 0.7451131604793488 -0.158622668804709 j q -0.9165215479156338 -0.8317747426285983 j r 0.017701925105413577 0.8509035245341184 <<U1> <<U1> <float64> <float64>
- Batch.via_values.__call__(*, consolidate_blocks, unify_blocks, dtype)
- Batch.via_values
Interface for applying a function to values in this container.
- InterfaceBatchValues.__call__(*, consolidate_blocks=False, unify_blocks=False, dtype=None)[source]
- Parameters:
consolidate_blocks – Group adjacent same-typed arrays into 2D arrays.
unify_blocks – Group all arrays into single array, re-typing to an appropriate dtype.
dtype – specify a dtype to be used in conversion before consolidation or unification, and before function application.
>>> 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> >>> np.sin(bt.via_values(unify_blocks=True)).to_frame() <Frame> <Index> a b <<U1> <IndexHierarchy> i p 0.0 0.8414709848078965 i q 0.9092974268256817 0.1411200080598672 i r -0.7568024953079282 -0.9589242746631385 j p 0.7451131604793488 -0.158622668804709 j q -0.9165215479156338 -0.8317747426285983 j r 0.017701925105413577 0.8509035245341184 <<U1> <<U1> <float64> <float64>
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