Replace comma with dot Pandas

前端 未结 2 1980
野趣味
野趣味 2020-12-02 21:18

Given the following array, I want to replace commas with dots:

array([\'0,140711\', \'0,140711\', \'0,0999\', \'0,0999\', \'0,001\', \'0,001\',
       \'0,14         


        
2条回答
  •  离开以前
    2020-12-02 21:26

    If you are reading in with read_csv, you can specify how it interprets decimals with the decimal parameter.

    e.g.

    your_df = pd.read_csv('/your_path/your_file.csv',sep=';',decimal=',')
    

    From the man pages:

    thousands : str, optional Thousands separator.

    decimal : str, default ‘.’ Character to recognize as decimal point (e.g. use ‘,’ for European data).

提交回复
热议问题