Skip to content

Fix DataFrame.agg produces different types if the DataFrame is empty #41722

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

Closed
wants to merge 7 commits into from
Closed

Fix DataFrame.agg produces different types if the DataFrame is empty #41722

wants to merge 7 commits into from

Conversation

weikhor
Copy link
Contributor

@weikhor weikhor commented May 29, 2021

@pep8speaks
Copy link

pep8speaks commented May 29, 2021

Hello @weikhor! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-05-30 01:26:58 UTC

@weikhor weikhor changed the title Frame aggregate Fix DataFrame.agg produces different types if the DataFrame is empty May 29, 2021
@@ -0,0 +1,19 @@
import numpy as np

Copy link
Contributor

Choose a reason for hiding this comment

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

these go in pandas/tests/apply/test_frame_apply.py

there are already extensive tests, so find a good place to exercise the empty case

we have these, so model after

(pandas) jreback@lhs2:~/pandas-dev$ grep -r empty pandas/tests/apply/|grep def
pandas/tests/apply/test_frame_transform.py:def test_transform_empty_listlike(float_frame, ops, frame_or_series):
pandas/tests/apply/test_frame_transform.py:def test_transform_empty_dictlike(float_frame, ops, frame_or_series):
pandas/tests/apply/test_frame_transform.py:def test_transform_empty_dataframe():
pandas/tests/apply/test_series_apply.py:def test_apply_empty_integer_series_with_datetime_index():
pandas/tests/apply/test_series_apply.py:def test_map_empty(index):
pandas/tests/apply/test_frame_apply.py:def test_apply_empty(float_frame):
pandas/tests/apply/test_frame_apply.py:def test_apply_with_reduce_empty():
pandas/tests/apply/test_frame_apply.py:def test_apply_funcs_over_empty(func):
pandas/tests/apply/test_frame_apply.py:def test_nunique_empty():
pandas/tests/apply/test_frame_apply.py:def test_apply_empty_infer_type():
pandas/tests/apply/test_frame_apply.py:def test_apply_empty_list_reduce():

@jreback jreback added the Reduction Operations sum, mean, min, max, etc. label May 31, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2021

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Jul 1, 2021
@simonjayhawkins
Copy link
Member

Thanks @weikhor for the PR. can you add a release note to doc/source/whatsnew/v1.3.1.rst, Bug fixes section and address #41722 (comment)

@mroeschke
Copy link
Member

Thanks for the PR, but it appears this has gone stale and needs addressing of the reviews. Closing, but happy to reopen if still interested.

@mroeschke mroeschke closed this Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reduction Operations sum, mean, min, max, etc. Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.agg produces different types if the DataFrame is empty
6 participants