MCPcopy
hub / github.com/pydata/xarray / _nanmean_ddof_object

Function _nanmean_ddof_object

xarray/computation/nanops.py:108–119  ·  view source on GitHub ↗

In house nanmean. ddof argument will be used in _nanvar method

(ddof, value, axis=None, dtype=None, **kwargs)

Source from the content-addressed store, hash-verified

106
107
108def _nanmean_ddof_object(ddof, value, axis=None, dtype=None, **kwargs):
109 """In house nanmean. ddof argument will be used in _nanvar method"""
110 valid_count = count(value, axis=axis)
111 value = fillna(value, 0)
112 # As dtype inference is impossible for object dtype, we assume float
113 # https://github.com/dask/dask/issues/3162
114 if dtype is None and value.dtype.kind == "O":
115 dtype = float
116
117 data = np.sum(value, axis=axis, dtype=dtype, **kwargs)
118 data = data / (valid_count - ddof)
119 return where_method(data, valid_count != 0)
120
121
122def nanmean(a, axis=None, dtype=None, out=None):

Callers 2

nanmeanFunction · 0.85
_nanvar_objectFunction · 0.85

Calls 4

countFunction · 0.90
fillnaFunction · 0.90
where_methodFunction · 0.90
sumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…