-
-
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
sel(method='nan') option filling missing values with NaN #1990
Comments
This is exactly what the |
I tried so allowing |
Yes, we want to support that. See #1553. We're already written most of the underlying machinery, so it should be pretty easy to add now. There are some backwards compatibility concerns with adjusting this for 1D arrays prior to a breaking release (see this warning), but I don't see any reason why we can't enable this for higher dimensional indexers right now. |
OK, that should solve my problem. I will go on using the NaT hack for now and refer back here as and when that stops working because |
Rationale
I would find it helpful to be able to specify "give me NaNs when the selector is not in the corresponding coordinate rather than raising an IndexError". This could go as a method option e.g.
method='nan'
.Currently I work around the problem by appending a row to the
data
array with time coordinateNaT
and all valuesNaN
, then replacing missing times fromtime_array
withNaT
. However, this gives a FutureWarning from xarray/core/duck_array_ops.py:138:In the future, 'NAT == x' and 'x == NAT' will always be False.
If this is something you would like to see then I could have a go at making a pull request for this.
The text was updated successfully, but these errors were encountered: