Pandas Dataframe Numbers Comma Formatted

Python python at python.invalid
Sat May 9 08:42:43 EDT 2020


Joydeep wrote:
> I have a Pandas dataframe like below.
> 
>      X        Y
> 0  12345    67890
> 1  54321    N/A
> 2  67890    123456
> 
> I need to make these numbers comma formatted. For example, 12345 =>
> 12,345.

 >>> value = 12345
 >>> f'{value:,}'  # >= 3.6
'12,345'
 >>> '{:,}'.format(value)  # >= 2.7
'12,345'


More information about the Python-list mailing list