-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for numpy NaN functions: nan{min,max,mean,argmin,argmax,sum} #126
Comments
It works fine in my computer (Pint develop branch) >>> import numpy as np
>>> import pint
>>> ureg = pint.UnitRegistry()
>>> [1., 2., 3., float('NaN')] * ureg.meter
<Quantity([ 1. 2. 3. nan], 'meter')>
>>> q = [1., 2., 3., float('NaN')] * ureg.meter
>>> np.nanmean(q)
2.0
>>> np.nanmax(q)
3.0
>>> np.nanargmin(q)
0
>>> np.nanargmax(q)
2 What it does not work (and should) is assigning a NaN: >>> q[0] = np.nan
Traceback (most recent call last):
...
ValueError
>>> q[0] = float('NaN')
Traceback (most recent call last):
...
ValueError I am opening a new issue for this. |
Sorry. My mistake. |
Also, |
(Oops, it seems that we commented together) Also, please take a look at the docs and this numpy issue. NumPy devs don't think that this is a problem as the issue was closes right away. I am seriously considering having an additional |
I'm fairly new to this level of Python development, but it seems we cannot / should not patch numpy so that |
Pint supports NumPy functions without monkey patching NumPy. It already supports mean since 0.2 (see https://github.com/hgrecco/pint/blob/master/pint/testsuite/test_numpy.py#L146) |
Review once that #905 is merged |
No description provided.
The text was updated successfully, but these errors were encountered: