Skip to content

TST: ensure that DataFrameGroupBy.apply does not convert datetime.date to pd.Timestamp #35504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 3, 2020

Conversation

smithto1
Copy link
Member

@smithto1 smithto1 commented Aug 1, 2020

Previously, there was a bug in DataFrameGroupBy.apply where a column of datetime.date would raise a ValueError if it was included as column in a multi-column grouping. Somewhere in the grouping the values would be converted to pd.Timestamp and then when the pd.Timestamp couldn't be found in the index of datetime.dates it would throw an error.

This bug persisted until 1.0.5 but was fixed in 1.1.0 (not sure which change fixed it). In 1.1.0 the datetime.date are not converted to pd.Timestamp, so they are treated like any other dtype=object and left unchanged.

This PR adds a test to enforce this behaviour to make sure the bug does not arise again.

@rhshadrach rhshadrach added Apply Apply, Aggregate, Transform, Map Groupby Testing pandas testing functions or related to the test suite labels Aug 1, 2020
@jreback jreback added this to the 1.2 milestone Aug 3, 2020
@jreback jreback merged commit d367c8a into pandas-dev:master Aug 3, 2020
@jreback
Copy link
Contributor

jreback commented Aug 3, 2020

thanks @smithto1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map Groupby Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: groupby apply with head(1) raises keyerror with datetime grouper
3 participants