-
Notifications
You must be signed in to change notification settings - Fork 367
/
precompile.jl
73 lines (72 loc) · 2.48 KB
/
precompile.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import PrecompileTools
PrecompileTools.@compile_workload begin
df = DataFrame(a=[2, 5, 3, 1, 0], b=["a", "b", "c", "a", "b"], c=1:5,
p=PooledArray(["a", "b", "c", "a", "b"]),
q=[true, false, true, false, true],
f=Float64[2, 5, 3, 1, 0])
describe(df)
names(df[1, 1:2])
sort(df, :a)
combine(df, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor)
transform(df, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor)
groupby(df, :a)
groupby(df, :p)
groupby(df, :q)
gdf = groupby(df, :b)
combine(gdf, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor)
transform(gdf, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor)
innerjoin(df, df, on=:a, makeunique=true)
innerjoin(df, df, on=:b, makeunique=true)
innerjoin(df, df, on=:c, makeunique=true)
outerjoin(df, df, on=:a, makeunique=true)
outerjoin(df, df, on=:b, makeunique=true)
outerjoin(df, df, on=:c, makeunique=true)
leftjoin!(df, DataFrame(a=[2, 5, 3, 1, 0]), on=:a)
leftjoin!(df, DataFrame(b=["a", "b", "c", "d", "e"]), on=:b)
leftjoin!(df, DataFrame(c=1:5), on=:c)
reduce(vcat, [df, df])
show(IOBuffer(), df)
subset(df, :q)
subset!(copy(df), :q)
df[:, 1:2]
df[1:2, :]
df[1:2, 1:2]
@view df[:, 1:2]
@view df[1:2, :]
@view df[1:2, 1:2]
transform!(df, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor)
deleteat!(df, 1)
append!(df, copy(df))
push!(df, copy(df[1, :]))
eachrow(df)
eachcol(df)
empty(df)
empty!(copy(df))
filter(:q => identity, df)
filter!(:q => identity, df)
first(df)
last(df)
hcat(df, df, makeunique=true)
issorted(df)
pop!(df)
popfirst!(df)
repeat(df, 2)
reverse(df)
reverse!(df)
unique(df, :a)
unique!(df, :a)
wide = DataFrame(id=1:6,
a=repeat(1:3, inner=2),
b=repeat(1.0:2.0, inner=3),
c=repeat(1.0:1.0, inner=6),
d=repeat(1.0:3.0, inner=2))
long = stack(wide)
unstack(long)
unstack(long, :variable, :value, combine=sum)
flatten(DataFrame(a=[[1, 2], [3, 4]], b=[1, 2]), :a)
dropmissing(DataFrame(a=[1, 2, 3, missing], b=["a", missing, "c", "d"]))
df = DataFrame(rand(20, 2), :auto)
df.id = repeat(1:2, 10)
combine(df, AsTable(r"x") .=> [ByRow(sum), ByRow(mean)])
combine(groupby(df, :id), AsTable(r"x") .=> [ByRow(sum), ByRow(mean)])
end