If you want to only modify the format of your values without doing any operation in pandas, you should just execute the following instruction:

pd.options.display.float_format = "{:,.2f}".format

This forces it not to use scientific notation (exponential notation) and always displays 2 places after the decimal point. It also adds commas.

You should be able to get more info here:

https://pandas.pydata.org/docs/user_guide/options.html#number-formatting

Examples:

0.0012             0.00
0.0123             0.01
1.2345             1.23
12.345             12.35
100                100.00
1234567890.123456  1,234,567,890.12
 
Answer from Zombraz on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › unable to increase pandas data frame decimal precision
r/learnpython on Reddit: Unable to increase pandas data frame decimal precision
January 4, 2024 -

Hello, I am having trouble increasing the decimal precision of a python data frame, and I cannot figure out what I am doing wrong.

I make the following data frame in python:

import pandas as pd

data = [['Blue', 34], ['Green', 61], ['Red', 22]] df = pd.DataFrame(data, columns=['Color', 'Value'])

df

and see:

    Color   Value

0 Blue 34 1 Green 61 2 Red 22

I then want to divide the "Value" column by 7, yielding new values in each row that will not divide evenly and have many decimal places of precision.

I then divide by 7 with:

df['Value'] = df['Value']/7

df

And I see:

     Color   Value

0 Blue 4.86 1 Green 8.71 2 Red 3.14

But I want to see more decimal precision than this. I would like to see 5 decimal places of precision.

And so I try using the .round() function with:

df.round(5)

And nothing has changed to the precision of the values, still just 2 decimal places.

I am not sure why selecting 5 decimal places here is not being applied to my indicated data frame.

I also tried running:

pd.set_option('display.precision', 4)

before calling the data frame, and still the decimal places do not change. How can I fix this code so that I get values with 5 decimal places of precision? Thanks!

🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.round.html
pandas.DataFrame.round — pandas 3.0.2 documentation
By providing an integer each column is rounded to the same number of decimal places · >>> df.round(1) dogs cats 0 0.2 0.3 1 0.0 0.7 2 0.7 0.0 3 0.2 0.2 · With a dict, the number of places for specific columns can be specified with the column names as key and the number of decimal places as value
Discussions

python - Set decimal precision of a pandas dataframe column with a datatype of Decimal - Stack Overflow
I have a pandas dataframe with two columns, col 1 with text in it and col 2 with decimal values. I use the '.apply' function to set the data type of the value column to Decimal (Python Decimal library). Once I do this the Value column goes from a 4 decimal place value to 43 decimal places. More on stackoverflow.com
🌐 stackoverflow.com
Can't adjust dataframes decimal places
I have a dataframe with integer and float columns like so: And as you can see, some values in the Days_to_Sell column have no decimal places, while others have 4. In order to try and have some sorts of consistency, I want to use only 2 decimal places. In order to achieved that, I use the panda’s ... More on discuss.streamlit.io
🌐 discuss.streamlit.io
1
4
February 14, 2020
python - Pandas adding decimal points when using read_csv - Stack Overflow
Note, the above method is not fool-proof: if by chance, a non-integer number column from the original data set contains non-integers that are all x.0000000, all the way to the last decimal place, this will fail. ... It was a datatype issue. ALollz's comment lead me in the right direction. Pandas ... More on stackoverflow.com
🌐 stackoverflow.com
python - Pandas data precision - Stack Overflow
By default the numerical values in data frame are stored up to 6 decimals only. How do I get the full precision. For example 34.98774564765 is stored as 34.987746. I do want the full value. and 0. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Medium
medium.com › @tubelwj › how-to-set-decimal-precision-and-display-formats-in-pandas-abf95de04b53
How to Set Data Decimal Precision and Display Formats in Pandas | by Gen. Devin DL. | Medium
December 14, 2025 - For example, df.round(2) will round the data in df to two decimal places. b) Using the set_option() method to globally control the decimal precision in pandas.
🌐
Data to Fish
datatofish.com › round-values-pandas-dataframe
How to Round Values in a pandas DataFrame
import pandas as pd data = {'fish': ['salmon', 'pufferfish', 'shark'], 'length_m': [1.523, 0.2165, 2.1], 'width_cm': [10.2, 3.14159, 90.0] } df = pd.DataFrame(data) print(df) fish length_m width_cm 0 salmon 1.5230 10.20000 1 pufferfish 0.2165 3.14159 2 shark 2.1000 90.00000 · To round the the length_m column to two decimals places, run the following: df['length_m'] = df['length_m'].round(2) print(df['length_m']) 0 1.52 1 0.22 2 2.10 Name: length_m, dtype: float64 ·
🌐
Streamlit
discuss.streamlit.io › using streamlit
Can't adjust dataframes decimal places - Using Streamlit - Streamlit
February 14, 2020 - I have a dataframe with integer and float columns like so: And as you can see, some values in the Days_to_Sell column have no decimal places, while others have 4. In order to try and have some sorts of consistency, I want to use only 2 decimal places. In order to achieved that, I use the panda’s round function like so: st.dataframe(df_display.round(2)) But got the same result.
Find elsewhere
🌐
Saturn Cloud
saturncloud.io › blog › how-to-set-decimal-precision-of-a-pandas-dataframe-column-with-decimal-datatype
How to Set Decimal Precision of a Pandas Dataframe Column with Decimal Datatype | Saturn Cloud Blog
January 4, 2024 - To set the decimal precision of a Pandas dataframe column with a Decimal datatype, you can use the round() method. The round() method rounds the Decimal object to the specified number of decimal places and returns a new Decimal object.
🌐
GeeksforGeeks
geeksforgeeks.org › python › pandas-dataframe-round
Pandas DataFrame round() Method | Round Values to Decimal - GeeksforGeeks
Example: This example shows how to round all values in a DataFrame to a fixed number of decimal places using the round() method. ... import pandas as pd df = pd.DataFrame({ "A": [1.2345, 2.3456], "B": [3.4567, 4.5678] }) print(df.round(2))
Published   January 13, 2026
Top answer
1 of 2
15

It seems you need DataFrame.round:

df = df.round(2)
print (df)
      NO  Topic A  Topic B  Topic C
0    0.0     1.00     1.00     1.00
1    1.0     0.55     0.64     0.55
2    2.0     0.57     0.74     0.68
3    3.0     0.85     0.86     0.85
4    4.0     0.20     0.20     0.20
5    5.0     0.85     0.84     0.85
6    6.0     0.45     0.53     0.45
7    7.0     0.62     0.66     0.70
8    8.0     0.57     0.50     0.57
9    9.0     0.85     0.90     0.88
10  10.0     0.95     0.97     0.96
2 of 2
2

The round method only works as I think you want if the values in each column (i.e., in each pandas.Series) of the DataFrame already have more decimal points than the value you are passing to round.

For instance:

pd.Series([1.09185, 2.31476]).round(2)

returns:

0    1.09
1    2.31
dtype: float64

But if the Series has fewer decimal points than the number you are trying to round, you will not get the desired visual result. For instance:

pd.Series([1.6, 2.3]).round(2)

returns:

0    1.6
1    2.3
dtype: float64

This is mathematically correct, since the numbers in the second Series already have fewer decimal points than 2. But it is not what you visually expect.

If you only want to change the display of a Series or DataFrame inside a notebook, you should use pandas.set_option("display.precision", 2). This changes the visual representation of the Series or DataFrame, without changing the inner precision of the actual numbers.

If for some reason you need to save a Series or DataFrame with the numbers already with the desired decimal points, you can apply a function that converts the object to string type and formats the string:

pd.Series([1.6, 2.3]).apply(lambda x: f"{x:.2f}")

which returns a new Series of dtype object instead of float:

0    1.60
1    2.30
dtype: object
🌐
IQCode
iqcode.com › code › python › pandas-decimal-places
pandas decimal places Code Example
March 17, 2022 - # (1) Round to specific decimal places – Single DataFrame column df['DataFrame column'].round(decimals=number of decimal places needed...
🌐
IQCode
iqcode.com › code › python › pandas-format-float-decimal-places
pandas format float decimal places Code Example
February 2, 2022 - # (1) Round to specific decimal places – Single DataFrame column df['DataFrame column'].round(decimals=number of decimal places needed...
🌐
Saturn Cloud
saturncloud.io › blog › set-decimal-precision-of-a-pandas-dataframe-column-with-a-datatype-of-decimal
Set Decimal Precision of a Pandas DataFrame Column with a Datatype of Decimal | Saturn Cloud Blog
September 9, 2023 - In this example, we’re rounding to 2 decimal places. And that’s it! You’ve successfully set the decimal precision of a pandas DataFrame column with a datatype of Decimal.
🌐
Pandas
pandas.pydata.org › pandas-docs › stable › reference › api › pandas.DataFrame.round.html
pandas.DataFrame.round — pandas 3.0.1 documentation
By providing an integer each column is rounded to the same number of decimal places · >>> df.round(1) dogs cats 0 0.2 0.3 1 0.0 0.7 2 0.7 0.0 3 0.2 0.2 · With a dict, the number of places for specific columns can be specified with the column names as key and the number of decimal places as value
🌐
GeeksforGeeks
geeksforgeeks.org › python › formatting-integer-column-of-dataframe-in-pandas
Formatting float column of Dataframe in Pandas - GeeksforGeeks
October 3, 2025 - This article covers simple ways to format floats in Pandas. You can round float values to a fixed number of decimal places using pd.options.display.float_format.
🌐
Vultr Docs
docs.vultr.com › python › third-party › pandas › DataFrame › round
Python Pandas DataFrame round() - Round Numeric Values | Vultr Docs
December 24, 2024 - import pandas as pd data = {'A': [2.333, 5.659, 1.123], 'B': [0.564, 0.9999, 2.365]} df = pd.DataFrame(data) # Rounding all data to 1 decimal place rounded_df = df.round(1) print(rounded_df) Explain Code
🌐
Beepscore
beepscore.com › website › 2018 › 10 › 12 › using-pandas-with-python-decimal.html
Using Pandas with Python Decimal for accurate currency arithmetic
For numbers with a decimal separator, ... and Pandas uses numpy float64. Internally float types use a base 2 representation which is convenient for binary computers. Python’s Decimal documentation shows example float inaccuracies. a = 1.1 + 2.2 print(a) # 3.3000000000000003 print(type(a)) # <class 'float'> ... Float is accurate enough for many uses. If you only display a few decimal places then you may ...