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

deprecate io support in describe #2027

Merged
merged 1 commit into from
Dec 1, 2019
Merged
Show file tree
Hide file tree
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
15 changes: 4 additions & 11 deletions src/abstractdataframe/abstractdataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@ to each column as the only argument. For columns allowing for missing values,
the vector is wrapped in a call to [`skipmissing`](@ref): custom functions must therefore
support such objects (and not only vectors), and cannot access missing values.

For consistency with DataAPI.jl an `io` argument can be passed to `describe` in
a first position but it is currently ignored.

# Examples
```julia
julia> df = DataFrame(i=1:10, x=0.1:0.1:1.0, y='a':'j')
Expand Down Expand Up @@ -337,17 +334,13 @@ julia> describe(df, :min, :sum => sum, cols=:x)
│ 1 │ x │ 0.1 │ 5.5 │
```
"""
DataAPI.describe(io::IO, df::AbstractDataFrame, stats::Union{Symbol, Pair{Symbol}}...;
cols=:) =
DataAPI.describe(df::AbstractDataFrame, stats::Union{Symbol, Pair{Symbol}}...; cols=:) =
_describe(select(df, cols, copycols=false), collect(stats))

DataAPI.describe(io::IO, df::AbstractDataFrame; cols=:) =
DataAPI.describe(df::AbstractDataFrame; cols=:) =
_describe(select(df, cols, copycols=false),
[:mean, :min, :median, :max, :nunique, :nmissing, :eltype])

DataAPI.describe(df::AbstractDataFrame, stats::Union{Symbol, Pair{Symbol}}...; cols=:) =
DataAPI.describe(stdout, df, stats...; cols=cols)

function _describe(df::AbstractDataFrame, stats::AbstractVector)
predefined_funs = Symbol[s for s in stats if s isa Symbol]

Expand Down Expand Up @@ -1426,8 +1419,8 @@ end
flatten(df::AbstractDataFrame, col::Union{Integer, Symbol})

When column `col` of data frame `df` has iterable elements that define `length` (for example
a `Vector` of `Vector`s), return a `DataFrame` where each element of `col` is flattened, meaning
the column corresponding to `col` becomes a longer `Vector` where the original entries
a `Vector` of `Vector`s), return a `DataFrame` where each element of `col` is flattened, meaning
the column corresponding to `col` becomes a longer `Vector` where the original entries
are concatenated. Elements of row `i` of `df` in columns other than `col` will be repeated
according to the length of `df[i, col]`. Note that these elements are not copied,
and thus if they are mutable changing them in the returned `DataFrame` will affect `df`.
Expand Down
4 changes: 4 additions & 0 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1546,3 +1546,7 @@ import Base: setproperty!
@deprecate permutecols!(df::DataFrame, p::AbstractVector) select!(df, p)
@deprecate names!(x::Index, nms::Vector{Symbol}; makeunique::Bool=false) rename!(x, nms, makeunique=makeunique)
@deprecate names!(df::AbstractDataFrame, vals::Vector{Symbol}; makeunique::Bool=false) rename!(df, vals, makeunique=makeunique)

import DataAPI: describe
@deprecate describe(io::IO, df::AbstractDataFrame, stats::Union{Symbol, Pair{Symbol}}...;
cols=:) describe(df, stats..., cols=cols)