I am new to Julia, when i am trying to import csv file
using CSV
CSV.read("C:\\Users\\...\\loan_predicton.csv")
I am getting below error
Error : ArgumentError: provide a valid sink argument, like `using DataFrames; CSV.read(source, DataFrame)`
Use:
using CSV
using DataFrames
df = CSV.read("C:\\Users\\...\\loan_predicton.csv", DataFrame)
After you will get some more experience with Julia you will find out that you can read a CSV file into different tabular data formats. That is why CSV.read
asks you to provide the type of the output you want to read your data into. Here is a small example:
julia> write("test.csv",
"""
a,b,c
1,2,3
4,5,6
""")
18
julia> using CSV, DataFrames
julia> CSV.read("test.csv", DataFrame)
2×3 DataFrame
Row │ a b c
│ Int64 Int64 Int64
─────┼─────────────────────
1 │ 1 2 3
2 │ 4 5 6
julia> CSV.read("test.csv", NamedTuple)
(a = [1, 4], b = [2, 5], c = [3, 6])
and you can see that in the first case you stored the result in a DataFrame
, and in the second a NamedTuple
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With