Home > Net >  How do I replace "NA" with "missing" when using CSV.read in Julia?
How do I replace "NA" with "missing" when using CSV.read in Julia?

Time:07-10

I have a csv file with a few NAs sprinkled in. Due to their presence, the columns containing the NAs are classified as strings rather than floats.

I just want to read the csv file with NAs in a way that Julia recognizes "NA" as a missing value rather than a string "NA." I tried the solution in this post; however, I get the following error:

ERROR: MethodError: no method matching CSV.File(::string; null="NA")

Any ideas on how to remedy this problem? Thank you.

CodePudding user response:

Use the missingstring="NA" keyword argument as described in the documentation.

  • Related