Skip to content

Commit 22ea7ab

Browse files
committed
review
1 parent bebe0ac commit 22ea7ab

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas/core/arrays/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,7 @@ def round(self, decimals: int = 0, *args, **kwargs) -> Self:
22952295
# Implementers are encouraged to override this method to avoid
22962296
# elementwise rounding.
22972297
if self.dtype._is_boolean:
2298-
return self
2298+
return self.copy()
22992299
if not self.dtype._is_numeric:
23002300
raise TypeError(f"Cannot round {type(self)} dtype as it is non-numeric")
23012301
return self._from_sequence(

pandas/tests/extension/base/methods.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,8 @@ def test_equals_same_data_different_object(self, data):
731731

732732
def test_round(self, data):
733733
if not data.dtype._is_numeric:
734-
with pytest.raises(TypeError):
734+
msg = "dtype as it is non-numeric"
735+
with tm.assert_produces_warning(TypeError, match=msg):
735736
data.round()
736737
elif data.dtype._is_boolean:
737738
result = pd.Series(data).round()

0 commit comments

Comments
 (0)