Skip to content

Commit

Permalink
Merge pull request #179 from davidanthoff/update-tests
Browse files Browse the repository at this point in the history
Update tests to DataFrames v0.11 world
  • Loading branch information
davidanthoff committed May 14, 2018
2 parents 63bb596 + 6bd059f commit 33a1231
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 156 deletions.
6 changes: 2 additions & 4 deletions example/05-Nullable.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using Query
using TypedTables
using DataFrames
using NullableArrays

df = @Table(name=NullableArray(["John", "Sally", "Kirk"]), age=NullableArray([23., 42., 59.]), children=NullableArray([3,5,2]))
df = DataFrame(name=["John", missing, "Kirk"], age=[23., 42., 59.], children=[3,5,2])

x = @from i in df begin
@where i.age>30 && i.children >2
@select {Name=lowercase(get(i.name))}
@select {Name=lowercase(i.name)}
@collect DataFrame
end

Expand Down
13 changes: 0 additions & 13 deletions example/07-typedtables.jl

This file was deleted.

6 changes: 3 additions & 3 deletions example/08-join.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using DataFrames, Query, TypedTables
using DataFrames, Query, IndexedTables

df1 = DataFrame(a=[1,2,3], b=[1.,2.,3.])
df2 = @Table(c=[2.,4.,2.], d=["John", "Jim","Sally"])
df2 = table([2.,4.,2.], ["John", "Jim","Sally"], names=[:c,:d])

x = @from i in df1 begin
@join j in df2 on get(i.a) equals convert(Int,j.c)
@join j in df2 on i.a equals convert(Int,j.c)
@select {i.a,i.b,j.c,j.d,e="Name: $(j.d)"}
@collect DataFrame
end
Expand Down
6 changes: 3 additions & 3 deletions example/17-groupjoin.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using DataFrames, Query, TypedTables
using DataFrames, Query, IndexedTables

df1 = DataFrame(a=[1,2,3], b=[1.,2.,3.])
df2 = @Table(c=[2.,4.,2.], d=["John", "Jim","Sally"])
df2 = table([2.,4.,2.], ["John", "Jim","Sally"], names=[:c,:d])

x = @from i in df1 begin
@join j in df2 on get(i.a) equals convert(Int,j.c) into k
@join j in df2 on i.a equals convert(Int,j.c) into k
@where i.a>1
@select {t1=i,t2=k}
@collect DataFrame
Expand Down
6 changes: 3 additions & 3 deletions example/19-feather.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Query, DataFrames, Feather
using Query, DataFrames, FileIO, FeatherFiles

testfile = joinpath(Pkg.dir("Feather"),"test", "data", "airquality.feather")
testfile = joinpath(Pkg.dir("FeatherLib"),"test", "data", "airquality.feather")

results = @from i in Feather.Source(testfile) begin
results = @from i in load(testfile) begin
@select i
@collect DataFrame
end
Expand Down
4 changes: 2 additions & 2 deletions example/21-nulls.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using DataFrames, Query
using DataFrames, Query, Missings

source_df_nulls = DataFrame(name=@data(["John", "Sally", NA, "Kirk"]), age=[23., 42., 54., 59.], children=@data([3,NA,8,2]))
source_df_nulls = DataFrame(name=["John", "Sally", missing, "Kirk"], age=[23., 42., 54., 59.], children=[3,missing,8,2])
q = @from i in source_df_nulls begin
@select i
@collect DataFrame
Expand Down
2 changes: 1 addition & 1 deletion example/23-dict-sink.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DataFrames
df = DataFrame(name=["John", "Sally", "Kirk"], age=[23., 42., 59.], children=[3,5,2])

q = @from i in df begin
@select get(i.name)=>get(i.children)
@select i.name=>i.children
@collect Dict
end

Expand Down
7 changes: 4 additions & 3 deletions example/24-DataTable.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using Query
using DataTables
using IndexedTables
using DataFrames

dt = DataTable(name=["John", "Sally", "Kirk"], age=[23., 42., 59.], children=[3,5,2])
dt = table(@NT(name=["John", "Sally", "Kirk"], age=[23., 42., 59.], children=[3,5,2]))

x = @from i in dt begin
@where i.age>30. && i.children > 2
@select {Name=lowercase(i.name)}
@collect DataTable
@collect DataFrame
end

println(x)
11 changes: 3 additions & 8 deletions test/REQUIRE
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
DataFrames
DataArrays
DataTables
TypedTables
# SQLite
DataStreams
CSV
JSON
Feather
NullableArrays
IndexedTables
FileIO
CSVFiles
FeatherFiles
Loading

0 comments on commit 33a1231

Please sign in to comment.