Skip to content
Advertisement

display pandas dataframe with european formatting

I found answers on the question on how to load csv files with european formatting into pandas dataframes and display them in the US format (2,345.21). However how can I display floats saved in the US format in the european format (2.345,21) in pandas.

I tried to just change dot and commas here:

from

JavaScript

to

JavaScript

but this doesn’t work. Another possibility could be to change the type to string and then replace dots with commas, but isn’t there a more elegant way?


It seems it works with locale aware seperators. If your operating system has the locale Germany it is pretty easy:

JavaScript

results to:

JavaScript

However now I am dealing with the problem to format the precision and the format for high numbers. As the result of the following format command is somewhat surprising.

JavaScript

Advertisement

Answer

Before you begin:

JavaScript

Then try this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement