While reading from csv I have ValueError: could not convert string to float
. It begins from readng the file, after I give names to columns and remove NaNs.
from pandas import read_csv
df = read_csv("propositio/data.csv", header=None,
sep=';', decimal=',')
cols = ['col1', 'col2', 'col3', 'col4']
df.columns = cols
df.dropna(inplace=True)
Here comes an error. I want to convert non-null object
into floats:
df = df.astype(float)
ValueError: could not convert string to float: '4,6'
How can I fix it?