I have a dataset that uses ".." instead of NaN and I am currently trying to convert those strings into NaN. I have tried the following:
for i in 1:length(final_df[:,1])
for j in 1:length(final_df[1,:])
if final_df[i,j] == ".."
final_df[i,j] = NaN
end
end
end
However I keep getting the following error: MethodError: Cannot 'convert' an object of type Float64 to an object of type String.
Here is a portion of the dataset for reference.
Any help is appreciated, thanks!
eltypes(df)wheredfis your DataFrame? This is so we know the types of the columns of your DataFrame. Also, based on the image you posted it appears the ".." only appear in in the fourth column of your DataFrame, so why are you iterating over the entire DataFrame in the code you posted? Couldn't you just iterate over the 4th column? - Colin T Bowers