I need a way to configure the show method of DataFrames.jl.
I have in the past hacked the show method for the DataFrames type using internal DataFrames API. But of course this breaks when an update comes along.
What I would like is to globally do the following:
- specify the number of rows printed while keeping the width adaptable
- be able to print all columns where the columns not fitting on the same line are printed in a new table and
- be able to specify the maximum string width.
In the past I have managed to hack something like this:
julia> dfshow(10, 20)
julia> df = DataFrame([Symbol(a)=>["sadlfhasdkfjhaasdfsdfsdfsadfasdfasdfasdfasdfa" for _ in 1:2000] for a in 'a':'f'])
2000×6 DataFrame
│ Row │ a │ b │ c │
│ │ String │ String │ String │
├──────┼─────────────────────────┼─────────────────────────┼─────────────────────────┤
│ 1 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 2 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 3 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 4 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
⋮
│ 1996 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 1997 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 1998 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 1999 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 2000 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ Row │ d │ e │ f │
│ │ String │ String │ String │
├──────┼─────────────────────────┼─────────────────────────┼─────────────────────────┤
│ 1 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 2 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 3 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 4 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
⋮
│ 1996 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 1997 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 1998 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 1999 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
│ 2000 │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │ sadlfhasdkfjhaasdfsd... │
Before opening an issue or trying to write a pull request, I thought I might ask if I just can’t find the correct documentation.
By the way this, using the newest DataFrame version with PrettyTables.jl:
julia> Base.active_repl.options.iocontext[:displaysize] = (20,displaysize(stdout)[2])
julia> df = DataFrame([Symbol(a)=>["sadlfhasdkfjhaasdfsdfsdfsadfasdfasdfasdfasdfa" for _ in 1:2000] for a in 'a':'f'])
2000×6 DataFrame
Row │ a b ⋯
│ String String ⋯
──────┼─────────────────────────────────────────────────────────────────
1 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad ⋯
2 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad
3 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad
4 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad
5 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad ⋯
6 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad
⋮ │ ⋮ ⋮ ⋱
1996 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad
1997 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad
1998 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad ⋯
1999 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad
2000 │ sadlfhasdkfjhaasdfsdfsdfsadfasdf… sadlfhasdkfjhaasdfsdfsdfsad
5 columns and 1989 rows omitted
already helps, but isn’t quite what I want, since I can’t see all columns.