diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 5d10a5541f556..2222164da90c7 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -10703,6 +10703,12 @@ def round( numpy.around : Round a numpy array to the given number of decimals. Series.round : Round a Series to the given number of decimals. + Notes + ----- + For values exactly halfway between rounded decimal values, pandas rounds + to the nearest even value (e.g. -0.5 and 0.5 round to 0.0, 1.5 and 2.5 + round to 2.0, etc.). + Examples -------- >>> df = pd.DataFrame( diff --git a/pandas/core/series.py b/pandas/core/series.py index 08e56cb4925b3..0be7a0a7aaa82 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2509,13 +2509,21 @@ def round(self, decimals: int = 0, *args, **kwargs) -> Series: numpy.around : Round values of an np.array. DataFrame.round : Round values of a DataFrame. + Notes + ----- + For values exactly halfway between rounded decimal values, pandas rounds + to the nearest even value (e.g. -0.5 and 0.5 round to 0.0, 1.5 and 2.5 + round to 2.0, etc.). + Examples -------- - >>> s = pd.Series([0.1, 1.3, 2.7]) + >>> s = pd.Series([-0.5, 0.1, 2.5, 1.3, 2.7]) >>> s.round() - 0 0.0 - 1 1.0 - 2 3.0 + 0 -0.0 + 1 0.0 + 2 2.0 + 3 1.0 + 4 3.0 dtype: float64 """ nv.validate_round(args, kwargs)