Skip to content

BUG: round on object columns no longer raises a TypeError #61399

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

Open
wants to merge 6 commits into
base: 2.3.x
Choose a base branch
from

Conversation

KevsterAmp
Copy link
Contributor

@KevsterAmp
Copy link
Contributor Author

pre-commit.ci is timing out and the 2 failed unit tests are canceled operations.

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.

Looking good - can you add a note in the 2.3 whatsnew. I think we should backport this as it's a regression.

cc @mroeschke

@@ -72,3 +72,9 @@ def test_round_ea_boolean(self):
tm.assert_series_equal(result, expected)
result.iloc[0] = False
tm.assert_series_equal(ser, expected)

def test_round_dtype_object(self):
ser = Series([0.2], dtype="object")
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 add a reference to the GitHub issue

@rhshadrach rhshadrach added Bug Regression Functionality that used to work in a prior pandas version Numeric Operations Arithmetic, Comparison, and Logical operations labels May 19, 2025
@rhshadrach rhshadrach added this to the 2.3 milestone May 19, 2025
@@ -2814,6 +2814,8 @@ def round(self, decimals: int = 0, *args, **kwargs) -> Series:
dtype: float64
"""
nv.validate_round(args, kwargs)
if self._mgr.dtype == "object":
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if self._mgr.dtype == "object":
if self.dtype == "object":

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants