pyspark.pandas.Series.round#

Series.round(decimals=0)[source]#

Round each value in a Series to the given number of decimals.

Parameters
decimalsint

Number of decimal places to round to (default: 0). If decimals are negative, it specifies the number of positions to the left of the decimal point.

Returns
Series object

See also

DataFrame.round

Examples

>>> df = ps.Series([0.028208, 0.038683, 0.877076], name='x')
>>> df
0    0.028208
1    0.038683
2    0.877076
Name: x, dtype: float64
>>> df.round(2)
0    0.03
1    0.04
2    0.88
Name: x, dtype: float64