Skip to content

Conversation

@lithomas1
Copy link
Contributor

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@lithomas1 lithomas1 added the metadata _metadata, .attrs label Jun 6, 2023
@lithomas1 lithomas1 marked this pull request as draft June 6, 2023 19:09
@lithomas1 lithomas1 marked this pull request as ready for review June 6, 2023 20:28
Comment on lines +10947 to +10948
if isinstance(result, Series):
result = result.__finalize__(self, method="any")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this only not a series when axis=None? Or are there other cases where a DataFrame can be reduced to a scaler?

I'd slightly prefer if axis is not None to this isinstance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably, but mypy won't be able to figure out that result is a Series without an isinstance/cast, though.

@mroeschke
Copy link
Member

pre-commit.ci autofix

@mroeschke mroeschke added this to the 2.1 milestone Aug 1, 2023
@mroeschke mroeschke merged commit 5e97e67 into pandas-dev:main Aug 1, 2023
@mroeschke
Copy link
Member

Thanks @lithomas1

@lithomas1 lithomas1 deleted the fix-reduction-metadata branch August 1, 2023 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metadata _metadata, .attrs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants