14. Mathematical / Logical / Statistical Utilities

Series, Frame, and Index, as well as their derived classes, provide support for common mathematical and statisticasl operations with NumPy.

14.1. Index

Mathematical and statistical operations, when applied on an Index, apply to the index labels.

Index.all(axis: int = 0, skipna: bool = True, **_: object) → Any

Logical and over values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.any(axis: int = 0, skipna: bool = True, **_: object) → Any

Logical or over values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.max(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the maximum along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.mean(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the mean along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.median(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the median along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.min(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the minimum along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.prod(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the product along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.std(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the standard deviaton along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.sum(axis: int = 0, skipna: bool = True, **_: object) → Any

Sum values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Index.var(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the variance along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

14.2. Series

Series.all(axis: int = 0, skipna: bool = True, **_: object) → Any

Logical and over values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.any(axis: int = 0, skipna: bool = True, **_: object) → Any

Logical or over values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.max(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the maximum along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.mean(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the mean along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.median(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the median along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.min(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the minimum along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.prod(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the product along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.std(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the standard deviaton along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.sum(axis: int = 0, skipna: bool = True, **_: object) → Any

Sum values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.var(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the variance along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Series.loc_min(*, skipna: bool = True) → Hashable[source]

Return the label corresponding to the minimum value found.

Parameters

skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

Series.loc_max(*, skipna: bool = True) → Hashable[source]

Return the label corresponding to the maximum value found.

Parameters

skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

Series.iloc_min(*, skipna: bool = True) → int[source]

Return the integer index corresponding to the minimum value found.

Parameters

skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

Series.iloc_max(*, skipna: bool = True) → int[source]

Return the integer index corresponding to the maximum value.

Parameters

skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

14.3. Frame

Frame.all(axis: int = 0, skipna: bool = True, **_: object) → Any

Logical and over values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.any(axis: int = 0, skipna: bool = True, **_: object) → Any

Logical or over values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.max(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the maximum along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.mean(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the mean along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.median(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the median along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.min(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the minimum along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.prod(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the product along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.std(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the standard deviaton along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.sum(axis: int = 0, skipna: bool = True, **_: object) → Any

Sum values along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.var(axis: int = 0, skipna: bool = True, **_: object) → Any

Return the variance along the specified axis.

Parameters
  • axis – Axis, defaulting to axis 0.

  • skipna – Skip missing (NaN) values, defaulting to True.

Frame.loc_min(*, skipna: bool = True, axis: int = 0) → static_frame.core.series.Series[source]

Return the labels corresponding to the minimum value found.

Parameters
  • skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.loc_max(*, skipna: bool = True, axis: int = 0) → static_frame.core.series.Series[source]

Return the labels corresponding to the maximum values found.

Parameters
  • skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.iloc_min(*, skipna: bool = True, axis: int = 0) → static_frame.core.series.Series[source]

Return the integer indices corresponding to the minimum values found.

Parameters
  • skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

Frame.iloc_max(*, skipna: bool = True, axis: int = 0) → static_frame.core.series.Series[source]

Return the integer indices corresponding to the maximum values found.

Parameters
  • skipna – if True, NaN or None values will be ignored; if False, a found NaN will propagate.

  • axis – Axis upon which to evaluate contiguous missing values, where 0 is vertically (between row values) and 1 is horizontally (between column values).

14.3.1. Examples

>>> f = sf.Frame.from_dict(dict(diameter=(12756, 142984, 120536), mass=(5.97, 1898, 568)), index=('Earth', 'Jupiter', 'Saturn'), dtypes=dict(diameter=np.int64))
>>> f
<Frame>
<Index> diameter mass      <<U8>
<Index>
Earth   12756    5.97
Jupiter 142984   1898.0
Saturn  120536   568.0
<<U7>   <int64>  <float64>

>>> f.max()
<Series>
<Index>
diameter 142984.0
mass     1898.0
<<U8>    <float64>
>>> f.min()
<Series>
<Index>
diameter 12756.0
mass     5.97
<<U8>    <float64>
>>> f.std()
<Series>
<Index>
diameter 56842.64155250587
mass     793.344204533358
<<U8>    <float64>
>>> f.sum()
<Series>
<Index>
diameter 276276.0
mass     2471.9700000000003
<<U8>    <float64>
>>> f.mean()
<Series>
<Index>
diameter 92092.0
mass     823.9900000000001
<<U8>    <float64>