Can't convert string number value to float

后端 未结 3 552
旧时难觅i
旧时难觅i 2021-01-21 08:19

I am working with a CSV file that contains 2 columns, the first a date column with format yyyymmdd, the second a string value that is in the format of a float, 0.0 for example.<

3条回答
  •  半阙折子戏
    2021-01-21 08:33

    float() doesn't modify a variable in-place, it returns the new typed value. Assign it back:

    rain_amount = float(rain_amount)
    

提交回复
热议问题