I have a pandas dataframe which has ~40 columns. I need to change the type of one of the columns to float (or numeric) but leave all the other columns unchanged.
All of the examples on this site that I've reviewed on this site either offer ways of converting the whole dataframe to a new type or return a single new column in isolation, neither of which is what I want.
Currently I'm doing this:
df[col] = df[col].astype(float)
but this now yields a setcopywithwarning from Pandas.
How do I change the type of a single column, in place; or copy the dataframe to a new dataframe, changing the type of one column in the process?