Add a decimal point with number of digits .2f see the docs: https://docs.python.org/2/library/string.html#format-specification-mini-language :

In [212]:
"{0:,.2f}".format(2083525.34561)

Out[212]:
'2,083,525.35'

For python 3 you can use f-strings (thanks to @Alex F):

In [2]:
value = 2083525.34561
f"{value:,.2f}"


Out[2]:
'2,083,525.35'
Answer from EdChum on Stack Overflow
🌐
Python Guides
pythonguides.com › python-format-number-with-commas
How To Format Numbers With Commas In Python?
December 22, 2025 - The first method to format a number with commas and 2 decimal places in Python is by using the f-strings method.
Discussions

How to format a number with comma and 2 decimal?
Did you try {{ "{:,.2f}".format(data[0]['amount'] }}? The very fine docs at https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.format say In most cases it should be more convenient and efficient to use the % operator or str.format(). More on reddit.com
🌐 r/flask
2
1
November 4, 2021
How to format a number with comma and specified precision digits in Python - Stack Overflow
The question is for Python 2.6, that is what we have in production. I have this requirement for formatting a number (like 1234567.0987 or 1234567.0) with comma, and specified number of digits after More on stackoverflow.com
🌐 stackoverflow.com
python - How to print a number using commas as thousands separators - Stack Overflow
How do I print an integer with commas as thousands separators? 1234567 ⟶ 1,234,567 It does not need to be locale-specific to decide between periods and commas. More on stackoverflow.com
🌐 stackoverflow.com
How do I put commas between numbers?
Say this is your number. a_number = 1234567890 You can add the commas like this print(format(a_number, ",")) or like this. print(f"{a_number:,}") Either way, what you're doing here is using a "format specifier" to create a string from the number formatted the way you like. A , means to format your integer or floating point number with commas every third numbers to the left of the decimal. You can see the full list of format specifiers here in the documentation (though TBH it's a bit hard to find what you need in it). More on reddit.com
🌐 r/learnpython
7
11
October 24, 2021
🌐
Bobby Hadz
bobbyhadz.com › blog › python-format-number-thousands-separator-2-decimals
Format number with comma as thousands separator in Python | bobbyhadz
April 9, 2024 - The same approach can be used to format a number with thousands separator to 2 decimal places. ... Copied! my_float = 489985.456789 # ✅ Format a number with comma as thousands separator rounded to 2 decimals result = f'{my_float:,.2f}' print(result) # 👉️ 489,985.46 # ✅ Format a number with comma as thousands separator rounded to 3 decimals result = f'{my_float:,.3f}' print(result) # 👉️ 489,985.457
🌐
YouTube
youtube.com › codesolve
python format number with commas and 2 decimal places - YouTube
Download this code from https://codegive.com In Python, formatting numbers with commas and a specific number of decimal places is a common requirement, espec...
Published   December 13, 2023
Views   46
🌐
Reddit
reddit.com › r/flask › how to format a number with comma and 2 decimal?
r/flask on Reddit: How to format a number with comma and 2 decimal?
November 4, 2021 -

I am trying to format a number like this 250,000.50

What I have tried

<td style="text-align:right;">${{"{0:,.2f}"|format(data[0]['amount']) }} </td>

<td style="text-align:right;">${{"{:0.2f}"|format(data[0]['amount']) }} </td>

<td style="text-align:right;">${{"{0:%.2f}"|format(data[0]['amount']) }} </td>

data[0]['amount']contains 250000.505050

🌐
Linux find Examples
queirozf.com › entries › python-number-formatting-examples
Python number formatting examples
August 2, 2023 - Drop digits after the second decimal place (if there are any). import re # see the notebook for a generalized version def truncate(num): return re.sub(r'^(\d+\.\d{,2})\d*$',r'\1',str(num)) truncate(8.499) # >>> '8.49' truncate(8.49) # >>> '8.49' truncate(8.4) # >>> '8.4' truncate(8.0) # >>> '8.0' truncate(8) # >>> '8'
Find elsewhere
Top answer
1 of 16
2569

Locale-agnostic: use _ as the thousand separator

f'{value:_}'          # For Python ≥3.6

Note that this will NOT format in the user's current locale and will always use _ as the thousand separator, so for example:

1234567 ⟶ 1_234_567

English style: use , as the thousand separator

'{:,}'.format(value)  # For Python ≥2.7
f'{value:,}'          # For Python ≥3.6

Locale-aware

import locale
locale.setlocale(locale.LC_ALL, '')  # Use '' for auto, or force e.g. to 'en_US.UTF-8'

'{:n}'.format(value)  # For Python ≥2.7
f'{value:n}'          # For Python ≥3.6

Reference

Per Format Specification Mini-Language,

The ',' option signals the use of a comma for a thousands separator. For a locale aware separator, use the 'n' integer presentation type instead.

and:

The '_' option signals the use of an underscore for a thousands separator for floating point presentation types and for integer presentation type 'd'. For integer presentation types 'b', 'o', 'x', and 'X', underscores will be inserted every 4 digits.

2 of 16
408

I'm surprised that no one has mentioned that you can do this with f-strings in Python 3.6+ as easy as this:

>>> num = 10000000
>>> print(f"{num:,}")
10,000,000

... where the part after the colon is the format specifier. The comma is the separator character you want, so f"{num:_}" uses underscores instead of a comma. Only "," and "_" is possible to use with this method.

This is equivalent of using format(num, ",") for older versions of python 3.

This might look like magic when you see it the first time, but it's not. It's just part of the language, and something that's commonly needed enough to have a shortcut available. To read more about it, have a look at the group subcomponent.

🌐
Herrmann
herrmann.tech › en › blog › 2021 › 02 › 05 › how-to-deal-with-international-data-formats-in-python.html
How to deal with international data formats in Python – herrmann.tech
February 5, 2021 - Decimal separator by place: Dot (.) Comma (,) Both (may vary by location or other factors) Arabic decimal separator (٫) Data unavailable Map by NuclearVacuum on Wikipedia · What people often do when interpreting those numbers with Python is simply using the replace method of the str class. In [1]: number = '12,75' In [2]: parsed = float(number.replace(',', '.')) In [3]: parsed Out[3]: 12.75 ·
🌐
AskPython
askpython.com › home › adding commas into number string
Adding commas into number string - AskPython
February 27, 2023 - To round the float format number with commas as thousands separators we use {:,.2f}. The digits beyond two places after the decimal get ignored. If we want to round the number to 3 places, we can do it by replacing 2 with 3. num = 2232890.82728 ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › print-number-commas-1000-separators-python
Print number with commas as 1000 separators in Python - GeeksforGeeks
May 14, 2025 - Here, we have used the "{:,}" along with the format() function to add commas every thousand places starting from left. This is introduced in Python and it automatically adds a comma on writing the following syntax.
🌐
Mark Needham
markhneedham.com › blog › 2021 › 04 › 11 › pandas-format-dataframe-numbers-commas-decimals
Pandas - Format DataFrame numbers with commas and control decimal places | Mark Needham
April 11, 2021 - df.drop(["LTLA Name"], axis=1).style.format("{:.2f}") This works, but we’ve lost the LTLA Name column and the Population column isn’t formatted how we’d like. Instead of passing a single style to style.format, we can instead pass a dictionary of {"column: "style"}. So to style Population with a comma as thousands separator and PercentageVaccinated with two decimal places, we can do the following:
🌐
GeeksforGeeks
geeksforgeeks.org › python › formatting-integer-column-of-dataframe-in-pandas
Formatting float column of Dataframe in Pandas - GeeksforGeeks
October 3, 2025 - '{:,.2f}'.format: Formats numbers with commas and 2 decimal places. .apply(lambda x: ...): Applies the formatting to each element in the column. Large numbers can be hard to interpret.
🌐
CopyProgramming
copyprogramming.com › howto › python-python-format-number-with-commas-and-decimal
Python Format Numbers with Commas and Decimal Places: Complete 2026 Guide
December 9, 2025 - Formatting numbers with both thousands separators and decimal precision requires combining the comma operator with decimal specification using the format {:,.Nf}, where N is the number of decimal places: # Format float with commas and 2 decimal places price = 1234567.899 formatted_price = ...
🌐
Delft Stack
delftstack.com › home › howto › python › python format number with commas
How to Format Number With Commas in Python | Delft Stack
February 2, 2024 - Here, the format specifier is ,d, representing that a decimal value is stored as an initial value. Finally, the str() function returns the initial and final value as a string. This method works based on the string formatter. String formatters are represented by curly braces {} that work by mentioning the replacement parameters and the place of those parameters. ... In this method, we first define a function called thousand_sep with its argument as the number in which commas are inserted.
🌐
Towards Data Science
towardsdatascience.com › home › latest › apply thousand separator (and other formatting) to pandas dataframe
Apply Thousand Separator (and Other Formatting) to Pandas Dataframe | Towards Data Science
January 28, 2025 - We use the python string format syntax '{:,.0f}'.format to add the thousand comma separators to the numbers. Then we use python’s map() function to iterate and apply the formatting to all the rows in the ‘Median Sales Price’ column.