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.

pd.Grouper support?

See original GitHub issue

In pandas, you can pas a pandas.TimeGrouper object to a .groupby() call, and it allows you to group by month, year, day, or other times, without manually creating a new index with those values first. It would be great if you could do this with xray, but at the moment, I get:

/usr/local/lib/python3.4/dist-packages/xray/core/groupby.py in __init__(self, obj, group, squeeze)
     66             if the dimension is squeezed out.
     67         """
---> 68         if group.ndim != 1:
     69             # TODO: remove this limitation?
     70             raise ValueError('`group` must be 1 dimensional')

AttributeError: 'TimeGrouper' object has no attribute 'ndim'

Not sure how this will work though, because pandas.TimeGrouper doesn’t appear to work with multi-index dataframes yet anyway, so maybe there needs to be a feature request over there too, or maybe it’s better to implement something from scratch…

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:24 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
shoyercommented, Nov 29, 2017

Well, the functionality is still there, it’s just recommended that you use pd.Grouper. On Wed, Nov 29, 2017 at 2:47 AM lexual notifications@github.com wrote:

pd.TimeGrouper is deprecated in latest pandas release, so I imagine this bug should be closed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pydata/xarray/issues/364#issuecomment-347735817, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKS1pVxryyv73zANrbH-ncx-UjspMkFks5s7MXRgaJpZM4DredK .

0reactions
stale[bot]commented, Dec 25, 2020

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity

If this issue remains relevant, please comment here or remove the stale label; otherwise it will be marked as closed automatically

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas.Grouper — pandas 1.5.2 documentation
A Grouper allows the user to specify a groupby instruction for an object. This specification will select a column via the key parameter,...
Read more >
support pd.Grouper in dd.DataFrame.groupby #1749 - GitHub
In pandas we can group using a time-based grouper and other columns. ... dask support this. pandas docs are here agg_cmg2 = df2.groupby([pd....
Read more >
Pandas Grouper and Agg Functions Explained
Explanation of panda's grouper and aggregation (agg) functions. ... import pandas as pd df = pd.read_excel("https://github.com/chris1610/ ...
Read more >
Pandas Grouper - Why can't it handle numerical columns in ...
pd.Grouper only supports binning of time objects like datetimes, periods or timedeltas. For other types, pd.Grouper will group by unique values.
Read more >
Using pandas.Grouper for multiple columns in MultiIndex
Grouper to groupby two different values in a MultiIndex and I can't seem to figure it out. Consider this example: import pandas as...
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