In my df I have some values set up as dtype(str)
x
27:47
13:45
10:45
And I would like to convert them to float, ending up with:
x
27.47
13.45
10.45
How do I do this?
Try this:
df['x'] = df['x'].replace(to_replace=":",value=".").astype(float)
.str is needed.df.x.astype(str)...but somehow it only works with .str before replace.str, still can't figure out what's the cause
27 mins, 47 secondsis not27.47minutes?47 secondsis about.76minute, not.47minute.