I'm trying to convert a column of strings to float after reading from a csv into pandas dataframe. Unfortunately, I get the following error:
ValueError: could not convert string to float: size
The code I am using is the following:
df['size'] = df['size'].apply(lambda x:float(x))
Any ideas?
A sample of my dataframe is below:
>>> df.head(4)
localtime symbol exchange price size
NaN localtime symbol exch price size
0 2017-08-01 13:30:00.130514241 AAPL NSDQ 149.08 71
1 2017-08-01 13:30:00.148672863 AAPL NSDQ 149.05 33
2 2017-08-01 13:30:00.148695312 AAPL BX 149.05 45
sizeseries. Looks like it has stringsize