Skip to content
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

calculate percentiles #561

Closed
mathause opened this issue Sep 8, 2015 · 3 comments · Fixed by #1187
Closed

calculate percentiles #561

mathause opened this issue Sep 8, 2015 · 3 comments · Fixed by #1187

Comments

@mathause
Copy link
Collaborator

mathause commented Sep 8, 2015

How would I calculate percentiles over a certain dimension?

ds.groupby('time.month').apply(np.percentile, q=5)

Does not work.

@clarkfitzg
Copy link
Member

ds = xray.tutorial.load_dataset('air_temperature')
percents = ds.groupby('time.month').reduce(np.percentile, q=5)

Producing:

In [80]: percents
Out[80]:
<xray.Dataset>
Dimensions:  (month: 12)
Coordinates:
  * month    (month) int64 1 2 3 4 5 6 7 8 9 10 11 12
Data variables:
    air      (month) float64 239.7 239.3 244.3 251.7 261.4 271.5 274.0 272.5 ...

@shoyer
Copy link
Member

shoyer commented Sep 9, 2015

Adding a dedicated method for calculating percentiles/quantiles would also be a good idea: #303

@mathause
Copy link
Collaborator Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants