Skip to content

Commit

Permalink
Fix failure due to calling pairs() on keyword arguments on Julia 0.6 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nalimilan authored and ararslan committed Dec 23, 2017
1 parent 855c963 commit 4abe138
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/DataFrames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/abstractdataframe/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dataframe/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4abe138

Please sign in to comment.