Skip to content

SeriesGroupBy.count() errors when original series is MultiIndex with Datetime as level 0 #1455

Closed
@dalejung

Description

@dalejung
from pandas import *

dr = date_range(start='1/1/2012', freq='5min', periods=10)

# BAD Example, datetimes first
labels = zip(dr, range(10))
s = Series(np.arange(10), index=MultiIndex.from_tuples(labels, names=['a','b']))
grouped = s.groupby(lambda x: x[1] % 2 == 0)

grouped.count()
# DateParseError: Could not parse COUNT

# Works fine
labels = zip(range(10), dr)
s = Series(np.arange(10), index=MultiIndex.from_tuples(labels, names=['a','b']))
grouped = s.groupby(lambda x: x[0] % 2 == 0)
grouped.count()
# False    5
# True     5

Seems to have happened within the last few days, maybe even just today.

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