-
-
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
Add quantile method to groupby object #3018
Comments
This is an awesome addition thankyou! I updated my a = np.ones((400)) * 10
a[3:7] = 0.2
a[10:13] = 0.2
p = np.repeat(a, 25).reshape(400, 5, 5)
lat = np.arange(0, 5)
lon = np.arange(0, 5)
time = pd.date_range('2000-01-01', freq='M', periods=p.shape[0])
d = xr.Dataset(
{'precip': (['time', 'lat', 'lon'], p)},
coords={
'lon': lon,
'lat': lat,
'time': time
}
)
d.groupby('time.month').quantile(q=0.1) gives the error message
Whereas for the d.precip.groupby('time.month').quantile(q=0.1)
Out[39]:
<xarray.DataArray 'precip' (month: 12)>
array([10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.])
Coordinates:
* month (month) int64 1 2 3 4 5 6 7 8 9 10 11 12 Is this the expected behaviour?
|
The PR only covered DataArrays, not Datasets, so yes, this is expected. |
Well that was an oversight. Any interest in opening a PR @tommylees112 or @huard |
OK looks like the method was added to the |
Dataset and DataArray objects have a quantile method, but not GroupBy. This would be useful for climatological analyses.
The text was updated successfully, but these errors were encountered: