ak.nan_to_num#

Defined in awkward.operations.ak_nan_to_num on line 20.

ak.nan_to_num(array, copy=True, nan=0.0, posinf=None, neginf=None, *, highlevel=True, behavior=None, attrs=None)#
Parameters:
  • array – Array-like data (anything ak.to_layout recognizes).

  • copy (bool) – Ignored (Awkward Arrays are immutable).

  • nan (int, float, broadcastable array) – Value to be used to fill NaN values.

  • posinf (None, int, float, broadcastable array) – Value to be used to fill positive infinity values. If None, positive infinities are replaced with a very large number.

  • neginf (None, int, float, broadcastable array) – Value to be used to fill negative infinity values. If None, negative infinities are replaced with a very small number.

  • highlevel (bool) – If True, return an ak.Array; otherwise, return a low-level ak.contents.Content subclass.

  • behavior (None or dict) – Custom ak.behavior for the output array, if high-level.

  • attrs (None or dict) – Custom attributes for the output array, if high-level.

Implements np.nan_to_num for Awkward Arrays, which replaces NaN (“not a number”) or infinity with specified values.

See also ak.nan_to_none to convert NaN to None, i.e. missing values with option-type.