Read in CSV, define values as undefined/null

I have some data as a CSV, but it includes some NAs. When I read it in, they are parsed as the string “NA” rather than null. How can I read in a CSV and specify selected values like “NA” as null or undefined?

This notebook shows an example using the penguins dataset.

Sup Zach. I don’t think there’s an “official” way to do this with just the stdlib file.csv method. I’d probably map the typed array to one with every instance of "NA" replaced with null:

typed.map((d) =>
  Object.fromEntries(
    Object.keys(d).map((key) => [key, d[key] === "NA" ? null : d[key]])
  )
)

Really good stuff. Thanks so much!