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