MCPcopy Index your code
hub / github.com/pydata/xarray / first

Function first

xarray/core/duck_array_ops.py:822–833  ·  view source on GitHub ↗

Return the first non-NA elements in this array along the given axis

(values, axis, skipna=None)

Source from the content-addressed store, hash-verified

820
821
822def first(values, axis, skipna=None):
823 """Return the first non-NA elements in this array along the given axis"""
824 if (skipna or skipna is None) and not (
825 dtypes.isdtype(values.dtype, "signed integer") or dtypes.is_string(values.dtype)
826 ):
827 # only bother for dtypes that can hold NaN
828 if is_chunked_array(values):
829 return chunked_nanfirst(values, axis)
830 else:
831 return nputils.nanfirst(values, axis)
832
833 return take(values, 0, axis=axis)
834
835
836def last(values, axis, skipna=None):

Callers 1

test_firstMethod · 0.90

Calls 2

is_chunked_arrayFunction · 0.90
chunked_nanfirstFunction · 0.85

Tested by 1

test_firstMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…