Skip to content

Commit 13b4776

Browse files
committed
Deprecate keys(df), values(df)
Of the associative methods left from the days when when DataFrame <: Associative, these two are pure duplication of functionality.
1 parent 1ae4b92 commit 13b4776

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/abstractdataframe/abstractdataframe.jl

-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ end
130130

131131
Base.haskey(df::AbstractDataFrame, key::Any) = haskey(index(df), key)
132132
Base.get(df::AbstractDataFrame, key::Any, default::Any) = haskey(df, key) ? df[key] : default
133-
Base.keys(df::AbstractDataFrame) = keys(index(df))
134-
Base.values(df::AbstractDataFrame) = columns(df)
135133
Base.isempty(df::AbstractDataFrame) = ncol(df) == 0
136134

137135
##############################################################################

src/deprecated.jl

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Base.@deprecate by(d::AbstractDataFrame, cols, s::Vector{Symbol}) aggregate(d, c
2525
Base.@deprecate by(d::AbstractDataFrame, cols, s::Symbol) aggregate(d, cols, eval(s))
2626
Base.@deprecate nullable!(colnames::Array{Symbol,1}, df::AbstractDataFrame) nullable!(df, colnames)
2727
Base.@deprecate nullable!(colnums::Array{Int,1}, df::AbstractDataFrame) nullable!(df, colnums)
28+
import Base: keys, values
29+
Base.@deprecate keys(df::AbstractDataFrame) names(df)
30+
Base.@deprecate values(df::AbstractDataFrame) DataFrames.columns(df)
2831

2932
const DEFAULT_COLUMN_ELTYPE = Float64
3033
function DataFrame(nrows::Integer, ncols::Integer)

test/dataframe.jl

-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ module TestDataFrame
8383
@test !haskey(df, :c)
8484
@test get(df, :a, -1) === df.columns[1]
8585
@test get(df, :c, -1) == -1
86-
@test keys(df) == [:a, :b]
87-
@test values(df) == Any[df[:a], df[:b]]
8886
@test !isempty(df)
8987

9088
@test empty!(df) === df

0 commit comments

Comments
 (0)