Tutorials References Menu

Pandas DataFrame round() Method

❮ DataFrame Reference


Example

Round each number in the DataFrame into 1 decimal numbers:

import pandas as pd

data = [[1.1235, 1.9654, 2.6874], [6.5124, 4.2210, 2.2899]]

df = pd.DataFrame(data)

print(df.round(1))
Try it Yourself »

Definition and Usage

The round() method rounds the values in the DataFrame into numbers with the specified number of decimals, default 0 decimals.


Syntax

dataframe.round(decimals, args, kwargs)

Parameters

Parameter Description
decimals Optional, a number|dictionary|Series. Default 0. Specifies the number of decimals. You can specify different numbers for different columns/rows by specifying the index/labels as keys in the dictionary, or indexes in a Series.
args Optional. These arguments has no effect, but could be accepted by a NumPy function
kwargs Optional, keyword arguments. These arguments has no effect, but could be accepted by a NumPy function

 Return Value

A DataFrame with the rounded values values.

This function does NOT make changes to the original DataFrame object.


❮ DataFrame Reference