Pandas Dataframe Numbers Comma Formatted
Joydeep C
chalao.adda at gmail.com
Sat May 9 09:11:33 EDT 2020
On Sat, 09 May 2020 14:42:43 +0200, Python wrote:
> 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'
I need all the numbers in the whole dataframe to be formatted like that,
not one value.
More information about the Python-list
mailing list