11. Missing Value Handling

static_frame.Series and static_frame.Frame provide convenient funcions for finding, dropping, and replacing missing values. In the tradition of Pandas, NaN and None values are treated as both missing, regardless of the dtype in which they are contained.

11.1. Series

Series.isna() → static_frame.core.series.Series[source]

Return a same-indexed, Boolean Series indicating which values are NaN or None.

Series.notna() → static_frame.core.series.Series[source]

Return a same-indexed, Boolean Series indicating which values are NaN or None.

Series.dropna() → static_frame.core.series.Series[source]

Return a new Series after removing values of NaN or None.

Series.fillna(value) → static_frame.core.series.Series[source]

Return a new Series after replacing null (NaN or None) with the supplied value.

Parameters

value – Value to be used to replace missing values (NaN or None).

Series.fillna_forward(limit: int = 0) → static_frame.core.series.Series[source]

Return a new Series after feeding forward the last non-null (NaN or None) observation across contiguous nulls.

Parameters

limit – Set the maximum count of missing values (NaN or None) to be filled per contiguous region of missing vlaues. A value of 0 is equivalent to no limit.

Series.fillna_backward(limit: int = 0) → static_frame.core.series.Series[source]

Return a new Series after feeding backward the last non-null (NaN or None) observation across contiguous nulls.

Parameters

limit – Set the maximum count of missing values (NaN or None) to be filled per contiguous region of missing vlaues. A value of 0 is equivalent to no limit.

Series.fillna_leading(value: Any) → static_frame.core.series.Series[source]

Return a new Series after filling leading (and only leading) null (NaN or None) with the supplied value.

Parameters

value – Value to be used to replace missing values (NaN or None).

Series.fillna_trailing(value: Any) → static_frame.core.series.Series[source]

Return a new Series after filling trailing (and only trailing) null (NaN or None) with the supplied value.

Parameters

value – Value to be used to replace missing values (NaN or None).

11.2. Frame

Frame.isna() → static_frame.core.frame.Frame[source]

Return a same-indexed, Boolean Frame indicating True which values are NaN or None.

Frame.notna() → static_frame.core.frame.Frame[source]

Return a same-indexed, Boolean Frame indicating True which values are not NaN or None.

Frame.dropna(axis: int = 0, condition: Callable[[numpy.ndarray], bool] = <function all>) → static_frame.core.frame.Frame[source]

Return a new Frame after removing rows (axis 0) or columns (axis 1) where condition is True, where condition is an NumPy ufunc that process the Boolean array returned by isna().

Frame.fillna(value: Any) → static_frame.core.frame.Frame[source]

Return a new Frame after replacing null (NaN or None) with the supplied value.

Parameters

value – Value to be used to replace missing values (NaN or None).

Frame.fillna_forward(limit: int = 0, *, axis: int = 0) → static_frame.core.frame.Frame[source]

Return a new Frame after filling forward null (NaN or None) with the supplied value.

Parameters
  • limit – Set the maximum count of missing values (NaN or None) to be filled per contiguous region of missing vlaues. A value of 0 is equivalent to no limit.

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

Frame.fillna_backward(limit: int = 0, *, axis: int = 0) → static_frame.core.frame.Frame[source]

Return a new Frame after filling backward null (NaN or None) with the supplied value.

Parameters
  • limit – Set the maximum count of missing values (NaN or None) to be filled per contiguous region of missing vlaues. A value of 0 is equivalent to no limit.

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

Frame.fillna_leading(value: Any, *, axis: int = 0) → static_frame.core.frame.Frame[source]

Return a new Frame after filling leading (and only leading) null (NaN or None) with the supplied value.

Parameters
  • value – Value to be used to replace missing values (NaN or None).

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

Frame.fillna_trailing(value: Any, *, axis: int = 0) → static_frame.core.frame.Frame[source]

Return a new Frame after filling trailing (and only trailing) null (NaN or None) with the supplied value.

Parameters
  • value – Value to be used to replace missing values (NaN or None).

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

Deviations from Pandas

dropna() takes a condition argument, which is a NumPy ufunc that accepts an axis argument. This differs from Pandas how argument. A how of “all” is equivalent to a condition of np.all; A how of “any” is equivalent to a condition of np.any.