Detail: Frame: Accessor Values

Overview: Frame: Accessor Values

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

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

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.

InterfaceValues.apply(func, *args, **kwargs)[source]
>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> f.via_values.apply(np.sin)
<Frame: x>
<Index>    a                   b                   c                   <<U1>
<Index>
p          -0.5440211108893698 0.9893582466233818  0.8414709848078965
q          -0.9092974268256817 -0.1411200080598672 0.0
r          0.0                 0.9893582466233818  0.4121184852417566
s          0.0                 0.0                 -0.5365729180004349
<<U1>      <float64>           <float64>           <float64>
Frame.via_values.__array_ufunc__(ufunc, method, *args, **kwargs)
Frame.via_values

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

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.

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

Support for applying NumPy functions directly on containers, returning NumPy arrays.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> np.sin(f.via_values)
<Frame: x>
<Index>    a                   b                   c                   <<U1>
<Index>
p          -0.5440211108893698 0.9893582466233818  0.8414709848078965
q          -0.9092974268256817 -0.1411200080598672 0.0
r          0.0                 0.9893582466233818  0.4121184852417566
s          0.0                 0.0                 -0.5365729180004349
<<U1>      <float64>           <float64>           <float64>
Frame.via_values.__call__(*, consolidate_blocks, unify_blocks, dtype)
Frame.via_values

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

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.

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.

>>> f = sf.Frame.from_fields(((10, -2, 0, 0), (8, -3, 8, 0), (1, 0, 9, 12)), index=('p', 'q', 'r', 's'), columns=('a', 'b', 'c'), name='x')
>>> np.sin(f.via_values(unify_blocks=True))
<Frame: x>
<Index>    a                   b                   c                   <<U1>
<Index>
p          -0.5440211108893698 0.9893582466233818  0.8414709848078965
q          -0.9092974268256817 -0.1411200080598672 0.0
r          0.0                 0.9893582466233818  0.4121184852417566
s          0.0                 0.0                 -0.5365729180004349
<<U1>      <float64>           <float64>           <float64>

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