Skip to content

BUG: groupby sum turning inf+inf and (-inf)+(-inf) into nan #53623

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 6 commits into from
Jun 14, 2023

Conversation

Charlie-XIAO
Copy link
Contributor

@Charlie-XIAO Charlie-XIAO commented Jun 12, 2023

This modifies group_sum in almost the way as #52964 for group_mean.

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Looks good! A few minor requests.

@rhshadrach
Copy link
Member

@Charlie-XIAO - small note, we like to use BUG: instead of FIX. See

https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#finally-make-the-pull-request

for more details.

@Charlie-XIAO
Copy link
Contributor Author

@Charlie-XIAO - small note, we like to use BUG: instead of FIX. See

https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#finally-make-the-pull-request

for more details.

Oh sure, sorry about that. I mixed up with the prefix of another project lol.

@Charlie-XIAO Charlie-XIAO changed the title FIX groupby sum turning inf into nan BUG groupby sum turning inf into nan Jun 13, 2023
@Charlie-XIAO Charlie-XIAO changed the title BUG groupby sum turning inf into nan BUG: groupby sum turning inf into nan Jun 13, 2023
@Charlie-XIAO Charlie-XIAO changed the title BUG: groupby sum turning inf into nan BUG: groupby sum turning np.inf+np.inf and (-np.inf)+(-np.inf) into nan Jun 13, 2023
@Charlie-XIAO Charlie-XIAO changed the title BUG: groupby sum turning np.inf+np.inf and (-np.inf)+(-np.inf) into nan BUG: groupby sum turning inf+inf and (-inf)+(-inf) into nan Jun 13, 2023
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

lgtm

@rhshadrach rhshadrach added the Reduction Operations sum, mean, min, max, etc. label Jun 14, 2023
@rhshadrach rhshadrach added this to the 2.1 milestone Jun 14, 2023
@rhshadrach rhshadrach merged commit aca58cd into pandas-dev:main Jun 14, 2023
@rhshadrach
Copy link
Member

Thanks @Charlie-XIAO!

mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Jun 15, 2023
mroeschke added a commit that referenced this pull request Jun 21, 2023
* CI: Build pandas even if doctests fail

* BUG: groupby sum turning `inf+inf` and `(-inf)+(-inf)` into `nan` (#53623)

* DEPR: method, limit in NDFrame.replace (#53492)

* DEPR: method, limit in NDFrame.replace

* update test, docs

* suppress doctest warning

* doctests

* PERF: Series.str.get_dummies for ArrowDtype(pa.string()) (#53655)

* PERF: Series.str.get_dummies for ArrowDtype(pa.string())

* whatsnew

* typing

* TYP: core.missing (#53625)

* CI: Attempt to fix wheel builds (#53670)

* DOC: Fixing EX01 - Added examples (#53647)

* SeriesGroupBy.fillna example added

* Added examples

* Corrected failing test for timedelta.total_seconds

* Corrected fillna example

* CI/TST: Mark test_to_read_gcs as single_cpu (#53677)

* BUG/CoW: is_range_indexer can't handle very large arrays (#53672)

* BUG: is_range_indexer can't handle very large arrays

* fix test on 32-bit

* TST: Use more pytest fixtures

---------

Co-authored-by: Yao Xiao <[email protected]>
Co-authored-by: jbrockmendel <[email protected]>
Co-authored-by: Luke Manley <[email protected]>
Co-authored-by: Thomas Li <[email protected]>
Co-authored-by: Dea María Léon <[email protected]>
@Charlie-XIAO Charlie-XIAO deleted the c-grpby-sum-inf branch June 28, 2023 05:40
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
* CI: Build pandas even if doctests fail

* BUG: groupby sum turning `inf+inf` and `(-inf)+(-inf)` into `nan` (pandas-dev#53623)

* DEPR: method, limit in NDFrame.replace (pandas-dev#53492)

* DEPR: method, limit in NDFrame.replace

* update test, docs

* suppress doctest warning

* doctests

* PERF: Series.str.get_dummies for ArrowDtype(pa.string()) (pandas-dev#53655)

* PERF: Series.str.get_dummies for ArrowDtype(pa.string())

* whatsnew

* typing

* TYP: core.missing (pandas-dev#53625)

* CI: Attempt to fix wheel builds (pandas-dev#53670)

* DOC: Fixing EX01 - Added examples (pandas-dev#53647)

* SeriesGroupBy.fillna example added

* Added examples

* Corrected failing test for timedelta.total_seconds

* Corrected fillna example

* CI/TST: Mark test_to_read_gcs as single_cpu (pandas-dev#53677)

* BUG/CoW: is_range_indexer can't handle very large arrays (pandas-dev#53672)

* BUG: is_range_indexer can't handle very large arrays

* fix test on 32-bit

* TST: Use more pytest fixtures

---------

Co-authored-by: Yao Xiao <[email protected]>
Co-authored-by: jbrockmendel <[email protected]>
Co-authored-by: Luke Manley <[email protected]>
Co-authored-by: Thomas Li <[email protected]>
Co-authored-by: Dea María Léon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Groupby Reduction Operations sum, mean, min, max, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: inconsistent treatment of numpy.Inf between groupby.sum() and groupby.apply(lambda: _grp: _grp.sum())
2 participants