Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 323
Ron Snow Avatar asked Jan 27 '26 10:01

Ron Snow


1 Answers

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

like image 198
Bogumił Kamiński Avatar answered Jan 30 '26 16:01

Bogumił Kamiński



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!