Editing and summing up
This wasn't clear from your input picture (please post as text) but it appears your input dataframe in fact contains both None and '..'
- error "TypeError: float() argument must be a string or a number, not 'NoneType'" indicates presence of 'None'
- error ValueError: could not convert string to float: '..' now indicates presence of some actual '..' strings.
- Forget applying lambdas: pandas.DataFrame.astype knows to skip NoneType without raising an error. Just get rid of arbitrary strings like '..' first.
Adapted answer:
One-liner, for in-place conversion:
df['col'] = np.where(df['col']=='..', None,
df['col']).astype('float')
Alternatively, decomposing steps simplifies the syntax: (no need for numpy.where)
(0) A mock-up of your initial dataframe: (Please post as text instead of image)
df = pd.DataFrame({'col' : ['-0.123',None, '..']})
df
col
0 -0.123
1 None
2 '..'
(1) First, curate your data by replacing cells of value '..' with None:
df.loc[df['col']=='..'] = None
df
col
0 -0.123
1 None
2 None
(2) Then apply data type conversion:
df['col'] = df['col'].astype('float64')
df
col
0 -0.123
1 NaN
2 NaN
Missing data are converted to 'not a number'.
Resulting data type is as requested:
df.dtypes
col float64
dtype: object
To go further: More pandas built-in column-wise datatype converters to be used instead of crafting you own lambda functions.