# CSV.read() error please provide a valid sink argument

**URL:** <https://discourse.julialang.org/t/csv-read-error-please-provide-a-valid-sink-argument/53437>\
**Category:** General Usage\
**Tags:** dataframes, csv\
**Created:** [January 16, 2021, 5:18pm UTC](https://discourse.julialang.org/t/csv-read-error-please-provide-a-valid-sink-argument/53437 "2021-01-16T17:18:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyhur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tonyhur/32/22732_2.png) [@tonyhur](https://discourse.julialang.org/u/tonyhur)\
**Post date:** [January 16, 2021, 5:18pm UTC](https://discourse.julialang.org/t/csv-read-error-please-provide-a-valid-sink-argument/53437/1 "2021-01-16T17:18:02Z")

</div>

Hello I anm new here. I work through the real great book “Julia Quick syntax reference” from Antonello Lobianco. I typed a code from page 183. What is wrong with

d\_table = CSV.read(IOBuffer(“”"  
plants new-york chicago topeka  
seattle 2.5 1.7 1.8  
san-diego 2.5 1.8 1.4  
“”“) , delim=” ", ignorerepeated=true, copycols=true)

The error when running is:

ArgumentError: provide a valid sink argument, like `using DataFrames; CSV.read(source, DataFrame)`

Apparently, it asks for a second argument “DataFrame” ??

Thanks for help  
Tony

---

<div class="post-metadata">

**Author:** ![FPGro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fpgro/32/20822_2.png) [@FPGro](https://discourse.julialang.org/u/FPGro)\
**Post date:** [January 16, 2021, 5:33pm UTC](https://discourse.julialang.org/t/csv-read-error-please-provide-a-valid-sink-argument/53437/2 "2021-01-16T17:33:36Z")

</div>

Hi Tony, welcome to the Julia community!  
When was the book written?

CSV uses the Tables.jl convention now, which means that it only provides a “backend” for understanding CSVs and the “frontend” needs to be another Tables sink which determines what you get out on the Julia side. It’s really easy, DataFrames is a good default. But this mechanism allows you to read a CSV directly into a database for example, without ever creating an intermediate table.

Furthermore, you should always enclose your code in ` backticks.  
So `print(“Hello world!”)` becomes `print("Hello world!")`

And using tripple ``` makes

```julia  
d\_table = CSV.read(IOBuffer(“”"  
plants new-york chicago topeka  
seattle 2.5 1.7 1.8  
san-diego 2.5 1.8 1.4  
“”“) , delim=” ", ignorerepeated=true, copycols=true)  
```

Appear as:

```julia
d_table = CSV.read(IOBuffer("""
plants new-york chicago topeka
seattle 2.5 1.7 1.8
san-diego 2.5 1.8 1.4
""") , delim=" ", ignorerepeated=true, copycols=true)

```

What you asked for is this:

```julia
julia> d_table = CSV.read(IOBuffer("""
        plants new-york chicago topeka
       seattle 2.5 1.7 1.8
       san-diego 2.5 1.8 1.4"""), DataFrame, delim=" ", ignorerepeated=true, copycols=true)
2×4 DataFrame
 Row │ plants new-york chicago topeka
     │ String Float64 Float64 Float64
─────┼───────────────────────────────────────
   1 │ seattle 2.5 1.7 1.8
   2 │ san-diego 2.5 1.8 1.4

```

---

<div class="post-metadata">

**Author:** ![tonyhur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tonyhur/32/22732_2.png) [@tonyhur](https://discourse.julialang.org/u/tonyhur)\
**Post date:** [January 16, 2021, 10:48pm UTC](https://discourse.julialang.org/t/csv-read-error-please-provide-a-valid-sink-argument/53437/3 "2021-01-16T22:48:29Z")

</div>

Hi FPGro,

Great, thank you. It worked right away. Well, the book is from 2019. Thanks also for your kind advise on how to post code.  
Tony

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [January 17, 2021, 8:03am UTC](https://discourse.julialang.org/t/csv-read-error-please-provide-a-valid-sink-argument/53437/4 "2021-01-17T08:03:57Z")

</div>

Regarding Antonello Lobianco’ s book you may also be interested in checking [this](https://github.com/sylvaticus/juliatutorial) out.
