Skip to content

Commit

Permalink
Move DataFrameRow push into deprecated.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Sep 26, 2018
1 parent 9e195a9 commit 2117671
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/DataFrames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ include("other/utils.jl")
include("other/index.jl")

include("abstractdataframe/abstractdataframe.jl")
include("dataframerow/dataframerow.jl")
include("dataframe/dataframe.jl")
include("subdataframe/subdataframe.jl")
include("groupeddataframe/grouping.jl")
include("dataframerow/dataframerow.jl")
include("dataframerow/utils.jl")

include("abstractdataframe/iteration.jl")
Expand Down
5 changes: 3 additions & 2 deletions src/dataframe/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ ncol(df::DataFrame) = length(index(df))
# Let getindex(columns(df)[j], row_inds) from AbstractVector() handle
# the resolution of row indices

# TODO: change Real to Integer in this union after deprecation period
const ColumnIndex = Union{Real, Symbol}

# df[SingleColumnIndex] => AbstractDataVector
function Base.getindex(df::DataFrame, col_ind::ColumnIndex)
selected_column = index(df)[col_ind]
Expand Down Expand Up @@ -1061,8 +1064,6 @@ function Base.push!(df::DataFrame, iterable::Any)
df
end

Base.push!(df::DataFrame, r::DataFrameRow) = push!(df, values(r))

##############################################################################
##
## Reorder columns
Expand Down
3 changes: 3 additions & 0 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,9 @@ import Base: vcat
import Base: collect
@deprecate collect(r::DataFrameRow) collect(pairs(r))

# Once `collect(::DataFrameRow)` emits values this method is no longer necessary
Base.push!(df::DataFrame, r::DataFrameRow) = push!(df, values(r))

import Base: show
@deprecate show(io::IO, df::AbstractDataFrame, allcols::Bool, rowlabel::Symbol, summary::Bool) show(io, df, allcols=allcols, rowlabel=rowlabel, summary=summary)
@deprecate show(io::IO, df::AbstractDataFrame, allcols::Bool, rowlabel::Symbol) show(io, df, allcols=allcols, rowlabel=rowlabel)
Expand Down
3 changes: 0 additions & 3 deletions src/other/index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
# through cleanly.
abstract type AbstractIndex end

# TODO: change Real to Integer in this union after deprecation period
const ColumnIndex = Union{Real, Symbol}

mutable struct Index <: AbstractIndex # an OrderedDict would be nice here...
lookup::Dict{Symbol, Int} # name => names array position
names::Vector{Symbol}
Expand Down

0 comments on commit 2117671

Please sign in to comment.