question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DatasetGroupBy does not implement quantile

See original GitHub issue

The docs claim quantile works on grouped datasets, but that does not seem to be the case:

>>> import xarray as xr
>>> ds = xr.Dataset(data_vars={"a": ("x", list("abcd"))}, coords={"x": range(4)})
>>> ds.a.groupby(ds.x % 2 == 0).quantile
<bound method DataArrayGroupBy.quantile of DataArrayGroupBy, grouped over 'x' 
2 groups with labels False, True.>
>>> ds.groupby(ds.x % 2 == 0).quantile
AttributeError: 'DatasetGroupBy' object has no attribute 'quantile'

this was found while trying to silence the nit-picky sphinx warnings in #3516

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
keewiscommented, Nov 13, 2019

the warnings are still there, but at least the quantile works (assuming the tests cover it). I’ll submit this as a PR.

0reactions
max-sixtycommented, Nov 13, 2019

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

quantile method on groupby of xarray dataset - Stack Overflow
These are monthly data (38 years of monthly data). I am interested in calculating the quantile values for each month separately. <xarray.Dataset> ...
Read more >
xarray.core.groupby.DatasetGroupBy.quantile
Compute the qth quantile over each array in the groups and concatenate them together into a new array. q ( float or sequence...
Read more >
pandas.DataFrame.groupby — pandas 1.5.2 documentation
When calling apply and the by argument produces a like-indexed (i.e. a transform) result, add group keys to index to identify pieces. By...
Read more >
How to Use Quantile Transforms for Machine Learning
Other nonlinear algorithms may not have this assumption, yet often perform better when variables have a Gaussian distribution.
Read more >
How to Calculate Quantiles by Group in Pandas - Statology
You can use the following basic syntax to calculate quantiles by group in Pandas: df.groupby('grouping_variable').quantile(.5).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found