Detail: Index: Accessor Values

Overview: Index: Accessor Values

Index.via_values.apply(func, *args, **kwargs)
Index.via_values

Interface for applying functions to values (as arrays) in this container.

InterfaceValues.apply(func, *args, **kwargs)[source]
>>> ix = sf.Index((0, 1024, -2048, 4096))
>>> ix
<Index>
0
1024
-2048
4096
<int64>
>>> ix.via_values.apply(np.sin)
<Index>
0.0
-0.15853338004399595
0.31305701279012343
-0.5946419876082146
<float64>
Index.via_values.__array_ufunc__(ufunc, method, *args, **kwargs)
Index.via_values

Interface for applying functions to values (as arrays) in this container.

InterfaceValues.__array_ufunc__(ufunc, method, *args, **kwargs)[source]

Support for applying NumPy functions directly on containers.

>>> ix = sf.Index((0, 1024, -2048, 4096))
>>> ix
<Index>
0
1024
-2048
4096
<int64>
>>> np.sin(ix.via_values)
<Index>
0.0
-0.15853338004399595
0.31305701279012343
-0.5946419876082146
<float64>
Index.via_values.__call__(*, consolidate_blocks, unify_blocks, dtype)
Index.via_values

Interface for applying functions to values (as arrays) in this container.

InterfaceValues.__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.

>>> ix = sf.Index((0, 1024, -2048, 4096))
>>> ix
<Index>
0
1024
-2048
4096
<int64>
>>> np.sin(ix.via_values(unify_blocks=True))
<Index>
0.0
-0.15853338004399595
0.31305701279012343
-0.5946419876082146
<float64>

Index: Constructor | Exporter | Attribute | Method | Dictionary-Like | Display | Selector | Iterator | Operator Binary | Operator Unary | Accessor Values | Accessor Datetime | Accessor String | Accessor Regular Expression | Accessor Hashlib | Accessor Type Clinic