The dataframe I am working on has a column containing strings with values like this:
df['Records Lost'][0]
'1,37e+09'
This is a string:
type(df['Records Lost'][0])
str
I tried converting to float but get this error:
float(df['Records Lost'][0])
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-36-88765fb941e9> in <module>()
----> 1 float(df['Records Lost'][0])
ValueError: could not convert string to float: '1,37e+09'
Tried pd.to_numeric
as per @Jezreal
pd.to_numeric(df['Records Lost'][0])
ValueError: Unable to parse string "1,37e+09" at position 0
pd.to_numeric([x.replace(',','.') for x in df['Records Lost'][0]])
ValueError: Unable to parse string "." at position 1
How do I convert this string to a float/int?