/
show.jl
51 lines (43 loc) · 1.23 KB
/
show.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
module TestShow
using DataFrames
using Compat
using Base.Test
import Compat.String
df = DataFrame(A = 1:3, B = ["x", "y", "z"])
io = IOBuffer()
show(io, df)
show(io, df, true)
showall(io, df)
showall(io, df, true)
subdf = sub(df, [2, 3]) # df[df[:A] .> 1.0, :]
show(io, subdf)
show(io, subdf, true)
showall(io, subdf)
showall(io, subdf, true)
dfvec = DataFrame[df for _=1:3]
show(io, dfvec)
showall(io, dfvec)
gd = groupby(df, :A)
show(io, gd)
showall(io, gd)
dfr = DataFrameRow(df, 1)
show(io, dfr)
df = DataFrame(A = Array(String, 3))
A = DataFrames.StackedVector(Any[[1, 2, 3], [4, 5, 6], [7, 8, 9]])
show(io, A)
A = DataFrames.RepeatedVector([1, 2, 3], 5, 1)
show(io, A)
A = DataFrames.RepeatedVector([1, 2, 3], 1, 5)
show(io, A)
#Test show output for REPL and similar
df = DataFrame(Fish = ["Suzy", "Amir"], Mass = [1.5, Nullable()])
io = IOBuffer()
show(io, df)
str = takebuf_string(io)
@test str == """
2×2 DataFrames.DataFrame
│ Row │ Fish │ Mass │
├─────┼──────┼───────┤
│ 1 │ Suzy │ 1.5 │
│ 2 │ Amir │ #NULL │"""
end