Hey everyone, I’m trying to use the CSV.read method, however I keep getting the argument “provide a valid sink argument”. I’ve tried putting in the path to my csv file I’m trying to load, but it still doesn’t work. The code I’ve used is as follows:
‘’’
Pkg.add(“CSV”)
Pkg.add(“DataFrames”)
using CSV, DataFrames
project_data = using DataFrames; CSV.read(“/Users/odionhillocks/Desktop/Project6925/Data.csv”, DataFrame)
Hi Marc, welcome to the community! It’s hard to diagnose this sort of issue if the reader can’t reproduce it. Can you provide more details (ideally a reproducible example following these guidelines)?
Try using CSV.File instead of CSV.read; I believe the latter might be only for reading into a specific Tables.jl-compatible sink (which is not what most users actually want).
But what goes in the place of “file” I tried putting the path to my file and it doesn’t work, if i put the file name only, it tells me the file is not valid.
The code I tried is placed below:
Pkg.add(“CSV”)
Pkg.add(“DataFrames”)
using CSV, DataFrames
project_data = using DataFrames; CSV.File(“/Users/odionhillocks/Desktop/Project6925/Data.csv”, DataFrame)
project_data = using DataFrames; CSV.read("/Users/odionhillocks/Desktop/Project6925/Data.csv", DataFrame)
was split in two, due to the ; character
project_data = using DataFrames
CSV.read("/Users/odionhillocks/Desktop/Project6925/Data.csv", DataFrame)
So, you read output of using DataFrames in project_data variable (which is a weird thing, suppose it was nothing?) and after that julia read csv file and ignore it.
If you need to use ; symbol, you should put it into brackets
but there is no sense in doing it in this line of code. Also do not put using statements inside calculations, it’s better to import library at the beginning of the script.