Skip to content

Commit

Permalink
Merge pull request #687 from JuliaData/jq/csvread
Browse files Browse the repository at this point in the history
Change deprecation warning for CSV.read
  • Loading branch information
quinnj authored Jul 28, 2020
2 parents 7e77bb3 + ac3761d commit c5ebf92
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/CSV.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@ include("rows.jl")
include("write.jl")

"""
`CSV.read(source; copycols::Bool=false, kwargs...)` => `DataFrame`
`CSV.read(source, sink::T; kwargs...)` => T
Parses a delimited file into a `DataFrame`. `copycols` determines whether a copy of columns should be made when creating the DataFrame; by default, no copy is made.
Read and parses a delimited file, materializing directly using the `sink` function.
`CSV.read` supports the same keyword arguments as [`CSV.File`](@ref).
`CSV.read` supports all the same keyword arguments as [`CSV.File`](@ref).
"""
function read(source; copycols::Bool=false, kwargs...)
@warn "`CSV.read(input; kw...)` is deprecated in favor of `DataFrame!(CSV.File(input; kw...))`"
DataFrame(CSV.File(source; kwargs...), copycols=copycols)
function read(source, sink=nothing; copycols::Bool=false, kwargs...)
if sink === nothing
@warn "`CSV.read(input; kw...)` is deprecated in favor of `CSV.read(input, DataFrame; kw...)"
sink = DataFrame
end
Tables.CopiedColumns(CSV.File(source; kwargs...)) |> sink
end

DataFrames.DataFrame(f::CSV.File; copycols::Bool=true) = DataFrame(getcolumns(f), getnames(f); copycols=copycols)

include("precompile.jl")
_precompile_()

Expand Down

0 comments on commit c5ebf92

Please sign in to comment.