Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change deprecation warning for CSV.read #687

Merged
merged 1 commit into from
Jul 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
bkamins marked this conversation as resolved.
Show resolved Hide resolved
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