Ignore CSV comments in a DataFrame


I’ve noticed that when creating a DataFrame using a CSV file, it registers comments as missing. For example, a section of my CSV file is

“Annual Interest Rate, 0.08
#ignore this”

but when I create the DataFrame as follows,

using CSV

q = CSV.File("C:\\Users\\Muadh\\.atom\\input_1.csv"; comment = "#", delim = ",") |> DataFrame

the DataFrame adds the extra row and is registered as a missing value. I know that readtable function allows comments, but I get warned that it’s a deprecated method. Is there any other possible way for the comment to be completely ignored?


Can you share the full file? Even if just privately with me? Happy to take a look at what’s going on here and fix it if there’s a problem. readtable is definitely going away soon, so we want to make sure CSV.jl is fully ready to handle any cases from that.

1 Like