Skip to content

TST: regression test for groupby with datetime and timedelta (#15562) #29063

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 1 commit into from
Oct 19, 2019

Conversation

jhereth
Copy link
Contributor

@jhereth jhereth commented Oct 17, 2019

This change doesn't add a new feature but adds an regression test for #15562 which has been fixed with pandas 0.20. Hence there is no whatsnew entry.

The bug was reported for pandas 0.18.1 and persisted until 0.19.2 but was fixed in 0.20.0(-rc1). I managed to reproduce the error (with numpy==1.12.1 on python 3.6, otherwise some errors unrelated to this bug appear).

I added an regression test to pandas/tests/groupby/test_apply.py and verified that the code will fail with 0.19.2 and succeed with 0.20.0 and master.

I wasn't able to further reduce the test provided by @field-cady.

B,2017-02-01 00:00:00
C,2017-02-01 00:00:00"""

df = pd.read_csv(StringIO(s))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you construct the dataframe manually without reading it as a csv?

df = pd.DataFrame([...])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure.

dict(clientid_age=ddf.time_delta_zero.min(), date=ddf.datetime.min())
)
)
assert result.shape == (3, 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you construct the expected dataframe and use tm.assert_frame_equal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. just pushed the update.

@jhereth jhereth force-pushed the 15562_regression_test branch from f21c172 to 4c580c3 Compare October 17, 2019 21:56
@jhereth
Copy link
Contributor Author

jhereth commented Oct 18, 2019

@mroeschke Change has been pushed. Some azure pipeline timed out. Is there a way to restart tests? Or should I re-push my branch?

(update: Apparently the command/comment /AzurePipelines run would work but I don't have the privileges. I replaced that comment after nothing happened apparently)

@azure-pipelines
Copy link
Contributor

Commenter does not have sufficient privileges for PR 29063 in repo pandas-dev/pandas

@mroeschke
Copy link
Member

If you merge master it will run the CI (master was having problems yesterday)

@jreback jreback added this to the 1.0 milestone Oct 18, 2019
@jreback jreback added the Testing pandas testing functions or related to the test suite label Oct 18, 2019
@jreback
Copy link
Contributor

jreback commented Oct 18, 2019

ok, ping on green.

@jhereth jhereth force-pushed the 15562_regression_test branch from 4c580c3 to eb3a547 Compare October 18, 2019 20:05
@jhereth jhereth force-pushed the 15562_regression_test branch from eb3a547 to 2fcf885 Compare October 18, 2019 22:00
@jhereth
Copy link
Contributor Author

jhereth commented Oct 18, 2019

@jreback Tests are green

@jreback jreback merged commit cb76dcb into pandas-dev:master Oct 19, 2019
@jreback
Copy link
Contributor

jreback commented Oct 19, 2019

thanks @qudade

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

Successfully merging this pull request may close these issues.

Failure in groupby-apply if aggregating timedelta and datetime columns
3 participants