-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Using min() with skipna=True #3290
Comments
Thanks for the issue @zxdawn . Did you try doing this?
|
@max-sixty Actually, I'm using numpy = 1.13.1 and I need skipna= True. Don't understand the error it shows. |
I think this may have been fixed by #2924 (which removed the line with Can you try upgrading to xarray 0.12.3? |
@shoyer Thank. It works now. But, I get another question.
If I want to get the minimum value by
Can't convert it to string by |
do you actually have any non-nan values in your array? From what I understand of how nanops work is that |
@keewis I tried to using
This is the type of |
For datetime64 arrays, use np.isnat() instead of isnan.
…On Sat, Sep 7, 2019 at 7:39 PM Xin Zhang ***@***.***> wrote:
@keewis <https://github.com/keewis> I tried to using
np.isnan(t.values).all() to check whether it's all nan. But, I got this
error:
print (np.isnan(t.values).all())
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
This is the type of t.values: <class 'numpy.ndarray'>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3290?email_source=notifications&email_token=AAJJFVWLAIBI55TBPAXWLDLQIRQWHA5CNFSM4IUO4E7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6FGMMY#issuecomment-529163827>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJJFVWBG7JHMQIYCYB3IJ3QIRQWHANCNFSM4IUO4E7A>
.
|
@shoyer Thanks. It's not datetime64 arrays, this is the result of
I use |
MCVE Code Sample
Problem Description
You can download the data from google drive.
I get errors shown in details, even using
skipna=True
.During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bug.py", line 31, in
west, east, north, south)
File "bug.py", line 16, in read_data
st = datetime.strptime(str(t.min(skipna=True).values), '%Y-%m-%dT%H:%M:%S.%fZ')
File "/public/software/anaconda/anaconda3/envs/behr/lib/python3.6/site-packages/xarray-0.11.3-py3.6.egg/xarray/core/common.py", line 25, in wrapped_func
skipna=skipna, allow_lazy=True, **kwargs)
File "/public/software/anaconda/anaconda3/envs/behr/lib/python3.6/site-packages/xarray-0.11.3-py3.6.egg/xarray/core/dataarray.py", line 1597, in reduce
var = self.variable.reduce(func, dim, axis, keep_attrs, **kwargs)
File "/public/software/anaconda/anaconda3/envs/behr/lib/python3.6/site-packages/xarray-0.11.3-py3.6.egg/xarray/core/variable.py", line 1354, in reduce
axis=axis, **kwargs)
File "/public/software/anaconda/anaconda3/envs/behr/lib/python3.6/site-packages/xarray-0.11.3-py3.6.egg/xarray/core/duck_array_ops.py", line 249, in f
raise NotImplementedError(msg)
NotImplementedError: min is not available with skipna=False with the installed version of numpy; upgrade to numpy 1.12 or newer to use skipna=True or skipna=None
Output of
xr.show_versions()
xarray: 0.11.3
pandas: 0.20.3
numpy: 1.13.1
scipy: 0.19.1
netCDF4: 1.4.2
pydap: None
h5netcdf: None
h5py: 2.9.0
Nio: None
zarr: None
cftime: 1.0.3.4
PseudonetCDF: None
rasterio: 1.0.21
cfgrib: None
iris: None
bottleneck: None
cyordereddict: None
dask: 1.1.2
distributed: None
matplotlib: 3.0.3
cartopy: 0.17.0
seaborn: 0.9.0
setuptools: 36.4.0
pip: 9.0.1
conda: None
pytest: None
IPython: None
sphinx: None
The text was updated successfully, but these errors were encountered: