0

as a result of my code I get a lot of integers. The integers represent an amount of euro's. Results do have different lengths, for example: 123456 euro, 6543321435 euro etc.

I want to make the results more readable. So the examples would be: 123.456 euro or 6.543.321.435 euro.

I've been looking in the Python str and int documentation but can't find it.

Maybe someone here on Stack?

thanks in advance. greeting Jan

Janneman
  • 343
  • 3
  • 13
  • Does this answer your question? [Add 'decimal-mark' thousands separators to a number](https://stackoverflow.com/questions/5513615/add-decimal-mark-thousands-separators-to-a-number) – fcdt Oct 19 '20 at 12:39
  • Hey, thanks. I couldn't find it on Stack myself. Thanks to the older similair question I did this and it works: totaal = format(int(df_new[my_list].values.sum()), ',f') – Janneman Oct 19 '20 at 12:43

1 Answers1

0

Do,

x_df = pd.DataFrame()
x_df['Amt'] = [123, 1234, 12345, 123456, 12345678, 123456789]
x_df['Amt'].map(lambda x: "{:,}".format(x))

0            123
1          1,234
2         12,345
3        123,456
4     12,345,678
5    123,456,789
Name: Amt, dtype: object
Sreeram TP
  • 11,346
  • 7
  • 54
  • 108