Skip to content

Grouping over PeriodIndex breaks its format #2569

Closed
@leonbaum

Description

@leonbaum

With the master branch (f014b01), grouping over a PeriodIndex is breaking the format of the index:

In [100]: df = pandas.DataFrame({'x': [1, 2, 3], 'y': ['2012-12-18', '2012-12-19', '2013-01-04']})

In [101]: df['y'] = df.y.astype('datetime64[D]')

In [102]: df = df.set_index('y').to_period('M')

In [103]: df
Out[103]: 
         x
2012-12  1
2012-12  2
2013-01  3

In [104]: df.groupby(level=0).sum()
Out[104]: 
     x
515  3
516  3

I would expect to still see the dates in the index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions