◐ Shell
clean mode source ↗

`numpy.nanstd` cannot be compatible with quantities

While running

import quantities as pq
import numpy as np
assert(pq.__version__== '0.14.1')
assert(np.__version__== '1.23.5')
np.nanstd([1.,2.]*pq.ms)

It reports:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.py", line 2298, in sum
    return _wrapreduction(a, np.add, 'sum', axis, dtype, out, keepdims=keepdims,
  File "/usr/local/lib/python3.10/dist-packages/numpy/core/fromnumeric.py", line 84, in _wrapreduction
    return reduction(axis=axis, out=out, **passkwargs)
TypeError: Quantity.sum() got an unexpected keyword argument 'keepdims'

However

np.mean([1.,2.]*pq.ms)
np.std([1.,2.]*pq.ms)
np.nanmean([1.,2.]*pq.ms)

all works fine.