diff --git a/pandas/core/series.py b/pandas/core/series.py index 512c24cc02f60..d5a1cda2397c1 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2579,6 +2579,11 @@ def round(self, decimals: int = 0, *args, **kwargs) -> Series: dtype: float64 """ nv.validate_round(args, kwargs) + + # Handle empty Series gracefully + if len(self) == 0: + return self.copy() + if self.dtype == "object": raise TypeError("Expected numeric dtype, got object instead.") new_mgr = self._mgr.round(decimals=decimals) diff --git a/pandas/tests/frame/methods/test_round.py b/pandas/tests/frame/methods/test_round.py index 5f2566fefca76..1ea0f7b30642a 100644 --- a/pandas/tests/frame/methods/test_round.py +++ b/pandas/tests/frame/methods/test_round.py @@ -227,3 +227,20 @@ def test_round_empty_not_input(self): result = df.round() tm.assert_frame_equal(df, result) assert df is not result + + def test_round_empty_series(self): + """Test that round works on empty Series.""" + # Empty Series with default object dtype + result = Series().round(4) + expected = Series() + tm.assert_series_equal(result, expected) + + # Empty Series with float dtype + result = Series(dtype="float64").round(4) + expected = Series(dtype="float64") + tm.assert_series_equal(result, expected) + + # Empty Series with int dtype + result = Series(dtype="int64").round(4) + expected = Series(dtype="int64") + tm.assert_series_equal(result, expected)