How To Replace " . " With " , " on a pandas.DataFrame

I have a dataframe that includes some numbers like 25.300, 27.474 etc. As you can see the digits divided by "." but I need to divide them with ",".

Here is my code:

all_data_df['Column 5'][1:10]= all_data_df['Column 5'][1:10].replace(".",",")

But it doesn’t work. How can I fix this issue?

>Solution :

We can replace . by , like so :

all_data_df['Column 5'] = all_data_df['Column 5'].astype(str).str.replace('.', ',', regex=True)

Leave a Reply