diff --git a/src/DataFrames.jl b/src/DataFrames.jl index 97439fbc79..d93b90fb7c 100644 --- a/src/DataFrames.jl +++ b/src/DataFrames.jl @@ -10,8 +10,12 @@ module DataFrames using Reexport, StatsBase, SortingAlgorithms, Compat @reexport using CategoricalArrays, Missings using Base: Sort, Order -using Compat: pairs +if VERSION >= v"0.7.0-DEV.2738" + const kwpairs = pairs +else + kwpairs(x::AbstractArray) = (first(v) => last(v) for v in x) +end if VERSION >= v"0.7.0-DEV.2915" using Unicode end diff --git a/src/abstractdataframe/sort.jl b/src/abstractdataframe/sort.jl index db7bf98234..75e4f9cffd 100644 --- a/src/abstractdataframe/sort.jl +++ b/src/abstractdataframe/sort.jl @@ -30,7 +30,7 @@ _getcol(x) = x # Get an Ordering for a single column ### function ordering(col_ord::UserColOrdering, lt::Function, by::Function, rev::Bool, order::Ordering) - for (k,v) in pairs(col_ord.kwargs) + for (k,v) in kwpairs(col_ord.kwargs) if k == :lt; lt = v elseif k == :by; by = v elseif k == :rev; rev = v diff --git a/src/dataframe/dataframe.jl b/src/dataframe/dataframe.jl index cd72bd2093..3fad35822d 100644 --- a/src/dataframe/dataframe.jl +++ b/src/dataframe/dataframe.jl @@ -116,7 +116,7 @@ function DataFrame(; kwargs...) if isempty(kwargs) DataFrame(Any[], Index()) else - DataFrame((k => v for (k,v) in pairs(kwargs))...) + DataFrame(kwpairs(kwargs)...) end end