ak.ones_like#

Defined in awkward.operations.ak_ones_like on line 9.

ak.ones_like(array)#
Parameters
  • array – Array-like data (anything ak.to_layout recognizes).

  • dtype (None or NumPy dtype) – Overrides the data type of the result.

  • highlevel (bool, default is True) – 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.

This is the equivalent of NumPy’s np.ones_like for Awkward Arrays.

See ak.full_like for details, and see also ak.zeros_like.

(There is no equivalent of NumPy’s np.empty_like because Awkward Arrays are immutable.)