jtablesaw / tablesaw

Java dataframe and visualization library
https://jtablesaw.github.io/tablesaw/
Apache License 2.0
3.55k stars 643 forks source link

CSV with value of "NA" read as empty string #1244

Closed alexp8 closed 11 months ago

alexp8 commented 11 months ago

I have a simple CSV:

header1,header2,header3 aa,bb,cc dd,ee,ff gg,NA,ii

Using Table.read().csv(), will remove "NA" from the csv.

Is this a known issue?

ccleva commented 11 months ago

Hi @alexp8. This is not an issue: by default "NA" is considered a missing value indicator when reading files, along with a few others textual values ("N/A", "NaN", etc.).

You can set the list of missing value indicators to you liking by using the missingValueIndicator(String...) method of CsvReadOptions and use these options to read the file.

Edit for clarity: this is done through the CsvReadOptions.Builder, not CsvReadOptions directly

alexp8 commented 11 months ago

I see, thanks so much!