From cbb54c792dc52ee3ea99da4f366fdb87a38c381b Mon Sep 17 00:00:00 2001 From: quinnj Date: Sat, 16 Dec 2017 22:45:00 -0700 Subject: [PATCH 1/4] 0.7 updates --- src/abstractdataframe/io.jl | 2 +- src/abstractdataframe/sort.jl | 2 +- src/dataframe/dataframe.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/abstractdataframe/io.jl b/src/abstractdataframe/io.jl index 8c68c3cb98..c6c3e1d262 100644 --- a/src/abstractdataframe/io.jl +++ b/src/abstractdataframe/io.jl @@ -229,7 +229,7 @@ Data.streamfrom(source::DataFrame, ::Type{Data.Field}, ::Type{T}, row, col) wher Data.streamtypes(::Type{DataFrame}) = [Data.Column, Data.Field] Data.weakrefstrings(::Type{DataFrame}) = true -allocate(::Type{T}, rows, ref) where {T} = Vector{T}(rows) +allocate(::Type{T}, rows, ref) where {T} = Vector{T}(uninitialized, rows) allocate(::Type{CategoricalString{R}}, rows, ref) where {R} = CategoricalArray{String, 1, R}(rows) allocate(::Type{Union{CategoricalString{R}, Missing}}, rows, ref) where {R} = CategoricalArray{Union{String, Missing}, 1, R}(rows) allocate(::Type{CategoricalValue{T, R}}, rows, ref) where {T, R} = diff --git a/src/abstractdataframe/sort.jl b/src/abstractdataframe/sort.jl index 5d5653dda8..db7bf98234 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 col_ord.kwargs + for (k,v) in pairs(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 13ca6b321c..cd72bd2093 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 kwargs)...) + DataFrame((k => v for (k,v) in pairs(kwargs))...) end end From 595d0373e23b48b5635dc27ac9e9449d627ad660 Mon Sep 17 00:00:00 2001 From: quinnj Date: Sat, 16 Dec 2017 22:46:09 -0700 Subject: [PATCH 2/4] 0.7 updates --- src/DataFrames.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/DataFrames.jl b/src/DataFrames.jl index f747b52f8e..99837b4343 100644 --- a/src/DataFrames.jl +++ b/src/DataFrames.jl @@ -1,6 +1,10 @@ __precompile__(true) module DataFrames +if !isdefined(Base, :pairs) + pairs(x) = x +end + ############################################################################## ## ## Dependencies From b2075f44f4cd1b915980c3989ced0232a57cc6b8 Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Mon, 18 Dec 2017 17:30:24 -0800 Subject: [PATCH 3/4] A couple more 0.7 fixes --- REQUIRE | 2 +- src/DataFrames.jl | 11 +++++++---- test/cat.jl | 2 +- test/constructors.jl | 2 +- test/conversions.jl | 2 +- test/data.jl | 2 +- test/dataframe.jl | 2 +- test/dataframerow.jl | 2 +- test/duplicates.jl | 2 +- test/grouping.jl | 2 +- test/index.jl | 2 +- test/io.jl | 2 +- test/iteration.jl | 2 +- test/join.jl | 2 +- test/runtests.jl | 2 +- test/show.jl | 2 +- test/sort.jl | 2 +- test/subdataframe.jl | 2 +- test/utils.jl | 2 +- 19 files changed, 25 insertions(+), 22 deletions(-) diff --git a/REQUIRE b/REQUIRE index 8584c242ff..c3231e7a61 100644 --- a/REQUIRE +++ b/REQUIRE @@ -7,4 +7,4 @@ Reexport WeakRefStrings 0.4.0 DataStreams 0.3.0 CodecZlib 0.4 -Compat 0.36.0 +Compat 0.40.0 diff --git a/src/DataFrames.jl b/src/DataFrames.jl index 99837b4343..eab7c6569a 100644 --- a/src/DataFrames.jl +++ b/src/DataFrames.jl @@ -1,10 +1,6 @@ __precompile__(true) module DataFrames -if !isdefined(Base, :pairs) - pairs(x) = x -end - ############################################################################## ## ## Dependencies @@ -15,6 +11,13 @@ using Reexport, StatsBase, SortingAlgorithms, Compat @reexport using CategoricalArrays, Missings using Base: Sort, Order +if VERSION >= v"0.7.0-DEV.2915" + using Unicode +end +if VERSION >= v"0.7.0-DEV.3052" + using Printf +end + ############################################################################## ## ## Exported methods and types (in addition to everything reexported above) diff --git a/test/cat.jl b/test/cat.jl index 76774507c0..3ba7de2455 100644 --- a/test/cat.jl +++ b/test/cat.jl @@ -1,5 +1,5 @@ module TestCat - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames const ≅ = isequal # diff --git a/test/constructors.jl b/test/constructors.jl index 916e69e9d2..fee4d03d11 100644 --- a/test/constructors.jl +++ b/test/constructors.jl @@ -1,5 +1,5 @@ module TestConstructors - using Base.Test, DataFrames, DataFrames.Index + using Compat, Compat.Test, DataFrames, DataFrames.Index const ≅ = isequal # diff --git a/test/conversions.jl b/test/conversions.jl index 502660ca7c..03d74d7ef5 100644 --- a/test/conversions.jl +++ b/test/conversions.jl @@ -1,5 +1,5 @@ module TestConversions - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames using DataStructures: OrderedDict, SortedDict const ≅ = isequal diff --git a/test/data.jl b/test/data.jl index 0e27568d68..3b5bc949a9 100644 --- a/test/data.jl +++ b/test/data.jl @@ -1,5 +1,5 @@ module TestData - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames importall Base # so that we get warnings for conflicts const ≅ = isequal diff --git a/test/dataframe.jl b/test/dataframe.jl index 16ceff2e4d..331318237c 100644 --- a/test/dataframe.jl +++ b/test/dataframe.jl @@ -1,5 +1,5 @@ module TestDataFrame - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames const ≅ = isequal const ≇ = !isequal diff --git a/test/dataframerow.jl b/test/dataframerow.jl index c08f17254f..c0078d79f1 100644 --- a/test/dataframerow.jl +++ b/test/dataframerow.jl @@ -1,5 +1,5 @@ module TestDataFrameRow - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames df = DataFrame(a=Union{Int, Missing}[1, 2, 3, 1, 2, 2], b=[2.0, missing, 1.2, 2.0, missing, missing], diff --git a/test/duplicates.jl b/test/duplicates.jl index 4f9aeed341..da0d69a81c 100644 --- a/test/duplicates.jl +++ b/test/duplicates.jl @@ -1,5 +1,5 @@ module TestDuplicates - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames const ≅ = isequal df = DataFrame(a = [1, 2, 3, 3, 4]) diff --git a/test/grouping.jl b/test/grouping.jl index e04042c7f3..de1ca8bad8 100644 --- a/test/grouping.jl +++ b/test/grouping.jl @@ -1,5 +1,5 @@ module TestGrouping - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames const ≅ = isequal srand(1) diff --git a/test/index.jl b/test/index.jl index 8da2e34861..9b8f33df5b 100644 --- a/test/index.jl +++ b/test/index.jl @@ -1,5 +1,5 @@ module TestIndex -using Base.Test, DataFrames, DataFrames.Index +using Compat, Compat.Test, DataFrames, DataFrames.Index i = Index() push!(i, :A) diff --git a/test/io.jl b/test/io.jl index d4d7174a93..b77eeb7bd3 100644 --- a/test/io.jl +++ b/test/io.jl @@ -1,5 +1,5 @@ module TestIO - using Base.Test, DataFrames, CategoricalArrays + using Compat, Compat.Test, DataFrames, CategoricalArrays using LaTeXStrings # Test LaTeX export diff --git a/test/iteration.jl b/test/iteration.jl index 7ddfed8000..51590160dc 100644 --- a/test/iteration.jl +++ b/test/iteration.jl @@ -1,5 +1,5 @@ module TestIteration - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames dv = [1, 2, missing] dm = Union{Int, Missing}[1 2; 3 4] diff --git a/test/join.jl b/test/join.jl index 59412d762d..fb4b11e1dc 100644 --- a/test/join.jl +++ b/test/join.jl @@ -1,5 +1,5 @@ module TestJoin - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames const ≅ = isequal name = DataFrame(ID = Union{Int, Missing}[1, 2, 3], diff --git a/test/runtests.jl b/test/runtests.jl index 6ab648c1e1..c54d0b9431 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,7 +6,7 @@ fatalerrors = length(ARGS) > 0 && ARGS[1] == "-f" quiet = length(ARGS) > 0 && ARGS[1] == "-q" anyerrors = false -using Base.Test +using Compat, Compat.Test using DataFrames my_tests = ["utils.jl", diff --git a/test/show.jl b/test/show.jl index 9b8c0b4dad..6102588637 100644 --- a/test/show.jl +++ b/test/show.jl @@ -1,5 +1,5 @@ module TestShow - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames # In the future newline character \n should be added to this test case df = DataFrame(A = Int64[1:4;], B = ["x\"", "∀ε>0: x+ε>x", "z\$", "ABC"], diff --git a/test/sort.jl b/test/sort.jl index 3250410a62..30ae45eb85 100644 --- a/test/sort.jl +++ b/test/sort.jl @@ -1,5 +1,5 @@ module TestSort - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames dv1 = [9, 1, 8, missing, 3, 3, 7, missing] dv2 = [9, 1, 8, missing, 3, 3, 7, missing] diff --git a/test/subdataframe.jl b/test/subdataframe.jl index 2cd00fa213..9ee4e71a48 100644 --- a/test/subdataframe.jl +++ b/test/subdataframe.jl @@ -1,5 +1,5 @@ module TestSubDataFrame - using Base.Test, DataFrames + using Compat, Compat.Test, DataFrames @testset "view -- DataFrame" begin df = DataFrame(x = 1:10, y = 1.0:10.0) diff --git a/test/utils.jl b/test/utils.jl index 07b843edf5..d9e700ee32 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -1,5 +1,5 @@ module TestUtils - using Base.Test, DataFrames, StatsBase + using Compat, Compat.Test, DataFrames, StatsBase import DataFrames: identifier @test identifier("%_B*_\tC*") == :_B_C_ From a705587774fe52880242f1d3f53f0fdf4b0a6d2a Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Mon, 18 Dec 2017 19:30:31 -0800 Subject: [PATCH 4/4] Compat.pairs --- src/DataFrames.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DataFrames.jl b/src/DataFrames.jl index eab7c6569a..97439fbc79 100644 --- a/src/DataFrames.jl +++ b/src/DataFrames.jl @@ -10,6 +10,7 @@ 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.2915" using Unicode