UndefVarError: readcsv not defined

I’m following Huda Nassar’s tutorial on Julia for data science.

However, I’m unable to run the readcsv or readdlm command in the very beginning.

The error message is:

UndefVarError: readcsv not defined

Stacktrace:
[1] top-level scope at In[7]:1

May I ask how to read csv file if the readcsv function is not available anymore?

In Julia 0.7, readcsv(io[, T::Type]; opts...) was deprecated in favor of readdlm(io, ','[, T]; opts...). readdlm is in the DelimitedFiles standard library, so you’ll need a using DelimitedFiles

4 Likes

@tkoolen is correct; the DelimitedFiles standard library exports the readdlm function, which provides basic delimited file reading functionality. With the CSV.jl package, you can call CSV.read which provides many additional features/options for reading delimited files. You can call ?CSV.read from the repl to see documentation for the function, you can also check out the extensive examples section of the package documentation.

3 Likes

Thank you, @tkoolen and @quinnj.

Following your advice, I read the csv file successfully as expected: