Skip to content

Commit 6073652

Browse files
author
Rik Huijzer
authored
Show an example on top of CSV.read (#1004)
1 parent 0217552 commit 6073652

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/CSV.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,30 @@ include("write.jl")
8282
Read and parses a delimited file or files, materializing directly using the `sink` function. Allows avoiding excessive copies
8383
of columns for certain sinks like `DataFrame`.
8484
85+
# Example
86+
```
87+
julia> using CSV, DataFrames
88+
89+
julia> path = tempname();
90+
91+
julia> write(path, "a,b,c\\n1,2,3");
92+
93+
julia> CSV.read(path, DataFrame)
94+
1×3 DataFrame
95+
Row │ a b c
96+
│ Int64 Int64 Int64
97+
─────┼─────────────────────
98+
1 │ 1 2 3
99+
100+
julia> CSV.read(path, DataFrame; header=false)
101+
2×3 DataFrame
102+
Row │ Column1 Column2 Column3
103+
│ String1 String1 String1
104+
─────┼───────────────────────────
105+
1 │ a b c
106+
2 │ 1 2 3
107+
```
108+
85109
$KEYWORD_DOCS
86110
"""
87111
function read(source, sink=nothing; copycols::Bool=false, kwargs...)

0 commit comments

Comments
 (0)