The round() function

The round() function helps in rounding off decimals. By default, the values are rounded off to a whole number:

sales_df.round()

The following is the output:

The round() function's results

The round function can be applied as shown here:

sales_df.round(decimals = 10)

The following is the output:

The round() function for decimals = 10

Get Mastering pandas - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.