Skip to content

pd.Grouper support? #364

Closed
Closed
@naught101

Description

@naught101

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...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions