So I've got a ginormous dataframe and in some of the columns I've got a mixture of float64 and strings saying "No Data". Any way of creating an algorithm that searches the dataframe and replaces those "No Data" with Nan? I'm fairly new to pandas, so any tip is greatly appreciated. Thanks!!
Asked
Active
Viewed 53 times
0
-
You could do it with simple indexing `df.loc[df[my_col] == "No Data", my_col] = np.nan` ? – Dan Feb 20 '20 at 13:50
-
But a cleaner way might be to use [`to_numeric`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_numeric.html) with `errors="coerce"` since the rest of the column contains floats already – Dan Feb 20 '20 at 13:52
-
1Thank you it worked perfectly!!! – Silent Storm Feb 21 '20 at 16:49