How can I convert one string column to float considering that it contains N/A values? I've tried to use the to_numeric function, but I'm receiving an error: "Unable to parse string "N/A" at position.
How can I convert one string column to float considering that it contains N/A values? I've tried to use the to_numeric function, but I'm receiving an error: "Unable to parse string "N/A" at position.
The solution that worked in my case was to add an argument errors='coerce' to the to_numeric function.
df["mycolumn"] = pd.to_numeric(df["mycolumn"], errors='coerce', downcast="float")