Detail: IndexHierarchyGO: Accessor Values

Overview: IndexHierarchyGO: Accessor Values

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

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

InterfaceValues.apply(func, *args, **kwargs)[source]
>>> ih = sf.IndexHierarchyGO.from_labels(((0, 1024, 32), (1, -2048, 32), (1, 1024, 32)), name=('x', 'y', 'z'))
>>> ih
<IndexHierarchyGO: ('x', 'y', 'z')>
0                                   1024    32
1                                   -2048   32
1                                   1024    32
<int64>                             <int64> <int64>
>>> ih.via_values.apply(np.sin)
<IndexHierarchyGO: ('x', 'y', 'z')>
0.0                                 -0.15853338004399595 0.5514266812416906
0.8414709848078965                  0.31305701279012343  0.5514266812416906
0.8414709848078965                  -0.15853338004399595 0.5514266812416906
<float64>                           <float64>            <float64>
IndexHierarchyGO.via_values.__array_ufunc__(ufunc, method, *args, **kwargs)
IndexHierarchyGO.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.

>>> ih = sf.IndexHierarchyGO.from_labels(((0, 1024, 32), (1, -2048, 32), (1, 1024, 32)), name=('x', 'y', 'z'))
>>> ih
<IndexHierarchyGO: ('x', 'y', 'z')>
0                                   1024    32
1                                   -2048   32
1                                   1024    32
<int64>                             <int64> <int64>
>>> np.sin(ih.via_values)
<IndexHierarchyGO: ('x', 'y', 'z')>
0.0                                 -0.15853338004399595 0.5514266812416906
0.8414709848078965                  0.31305701279012343  0.5514266812416906
0.8414709848078965                  -0.15853338004399595 0.5514266812416906
<float64>                           <float64>            <float64>
IndexHierarchyGO.via_values.__call__(*, consolidate_blocks, unify_blocks, dtype)
IndexHierarchyGO.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.

>>> ih = sf.IndexHierarchyGO.from_labels(((0, 1024, 32), (1, -2048, 32), (1, 1024, 32)), name=('x', 'y', 'z'))
>>> ih
<IndexHierarchyGO: ('x', 'y', 'z')>
0                                   1024    32
1                                   -2048   32
1                                   1024    32
<int64>                             <int64> <int64>
>>> np.sin(ih.via_values(unify_blocks=True))
<IndexHierarchyGO: ('x', 'y', 'z')>
0.0                                 -0.15853338004399595 0.5514266812416906
0.8414709848078965                  0.31305701279012343  0.5514266812416906
0.8414709848078965                  -0.15853338004399595 0.5514266812416906
<float64>                           <float64>            <float64>

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