MCPcopy Create free account
hub / github.com/dask/dask / kurtosis

Function kurtosis

dask/array/stats.py:296–322  ·  view source on GitHub ↗
(a, axis=0, fisher=True, bias=True, nan_policy="propagate")

Source from the content-addressed store, hash-verified

294
295@derived_from(scipy.stats)
296def kurtosis(a, axis=0, fisher=True, bias=True, nan_policy="propagate"):
297 if nan_policy != "propagate":
298 raise NotImplementedError(
299 "`nan_policy` other than 'propagate' have not been implemented."
300 )
301 n = a.shape[axis] # noqa; for bias
302 m2 = moment(a, 2, axis)
303 m4 = moment(a, 4, axis)
304 zero = m2 == 0
305 olderr = np.seterr(all="ignore")
306 try:
307 vals = da.where(zero, 0, m4 / m2**2.0)
308 finally:
309 np.seterr(**olderr)
310
311 if not bias:
312 # need a version of np.place
313 raise NotImplementedError("bias=False is not implemented.")
314
315 if fisher:
316 return vals - 3
317 else:
318 if vals.ndim == 0:
319 # TODO: scalar, min is a workaround
320 return vals.min()
321
322 return vals
323
324
325@derived_from(scipy.stats)

Callers 1

kurtosistestFunction · 0.85

Calls 3

momentFunction · 0.70
whereMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected