Help testing PrettyTables v0.10.0

Hi guys!

I just tagged v0.10.0 of PrettyTables.jl. It should be available really soon. This is a huge release, with a lot of new features, and, unfortunately, a lot of breaking changes (sorry!). The point of this release is to add all required features so that PrettyTables.jl can become the default back-end to print DataFrames.jl to text.

I am targeting v1.0 in which the text backend is marked as stable, i.e. no more API changes. Hence, I would like, if possible, to hear some feedback about the new features. This is our last time to make breaking changes easily :smiley: Bug reports are also very welcome!

Among the new features, the ones I like the most are:

Markdown rendering inside cells

 julia> using Markdown

julia> a = md"""
       # Header

       This is a paragraph.

       ```julia
       function test()
           return 1
       end
       ```
       """;

julia> b = md"""
       This _**is a bold text that will wrap inside a cell**_
       """;

julia> pretty_table([a b], columns_width = 20, autowrap = true, linebreaks = true)

Vertical cropping behavior

Finally, PrettyTables.jl can now crop the output at the middle instead of just at the bottom:

pretty_table(rand(100,100), vcrop_mode = :middle)

Titles

We also have title support now:

julia> pretty_table(rand(10,3), title = "Table title", title_alignment = :c, title_same_width_as_table = true)

PrettyTables.jl is so cool that runs on my RPiZero v1.5.2

This is fantastic. Thank you for working on this!

Looks nice!

How can I use it (with html backend) in Pluto or Jupyter?
Just calling pretty_table(df) prints the text version (in console for Pluto).

In this case you just need to switch the backend to HTML. In PrettyTables I do not look for MIME to select the output automatically. So, just call pretty_table with backend = :html.

With Pluto you can do:

HTML(sprint(io->pretty_table(io,df;backend=:html)))

Nice, in this case you can just pass String instead of the io: HTML(pretty_table(String, data, backend = :html).

Thanks for your help!

HTML(pretty_table(String, df2; backend=:html))

works for me in Pluto, but crops the columns if there are too many.

This code snippet prints all columns with scrollbars:

HTML("<div style=\"overflow:auto;\">" * pretty_table(String, df2; backend=:html) * "</div>")

vcrop_mode = :middle does not work for the html-backend, right?
For display in notebooks, I think it is best to show all columns (per scrollbar) and rows cropped in the middle as default.

Nice, there is a lot of room for improvements in HTML. I really focused the last few months on the text back-end, which is way more difficult. Probably, in HTML, we can do everything using the available features without requiring processing the table itself. For example, one way to avoid cropping is showing scroll bars both horizontally and vertically like you said. However, we may add the vertical cropping mechanism if necessary.

It is a great package! I am going to review the documentation and give you my feedback.

One suggestion before the final version, that I have though: It could be possible to have the same Highlighter API that could be used for Latex, Html or Text? In the depth, it could use the current existing LatexHightlighter, HTMLHighlighter, or Highlighter, and considering the backend to use finally one or another? It could be great if that would be possible (I could help you in a couple of weeks if the idea interest you).

Thanks! That will help a lot! :slight_smile:

Nice suggestion! This seems a very good feature. Do you mind opening an issue?

I am printing a DataFrame with pretty_table(df, nosubheader = true) and expected not to see the type of each column, but it is still being printed. Is this the correct behavior?

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  Variable │         Region 1 │       Region 2 │     Region 3 │       Region 4 │
│    String │           String │         String │       String │         String │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ Coeff. x⁰ │    A₀₁ = -88.728 │  A₀₂ = -12.046 │  Aā‚€ā‚ƒ = 3.248 │    A₀₄ = 0.106 │

This is strange. It is working perfectly here:

julia> df = DataFrame(a = [i == 2 ? missing : 10^i for i = -7:1.:7],
                      b = Int64.(1:1:15),
                      c = [i % 2 == 0 for i = 1:15],
                      d = [i == 2 ? "test" : 10^i for i = -7:1.:7],
                      e = [i == 2 ? -0.0 : i == 3 ? +0.0 : 10^i for i = -7:1.:7])
15Ɨ5 DataFrame
 Row │ a             b      c      d         e
     │ Float64?      Int64  Bool   Any       Float64
─────┼───────────────────────────────────────────────────
   1 │       1.0e-7      1  false  1.0e-7         1.0e-7
   2 │       1.0e-6      2   true  1.0e-6         1.0e-6
   3 │       1.0e-5      3  false  1.0e-5         1.0e-5
   4 │       0.0001      4   true  0.0001         0.0001
   5 │       0.001       5  false  0.001          0.001
   6 │       0.01        6   true  0.01           0.01
   7 │       0.1         7  false  0.1            0.1
   8 │       1.0         8   true  1.0            1.0
   9 │      10.0         9  false  10.0          10.0
  10 │ missing          10   true  test          -0.0
  11 │    1000.0        11  false  1000.0         0.0
  12 │   10000.0        12   true  10000.0    10000.0
  13 │  100000.0        13  false  100000.0  100000.0
  14 │       1.0e6      14   true  1.0e6          1.0e6
  15 │       1.0e7      15  false  1.0e7          1.0e7

julia> pretty_table(df, nosubheader = true)
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│        a │  b │     c │        d │        e │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│   1.0e-7 │  1 │ false │   1.0e-7 │   1.0e-7 │
│   1.0e-6 │  2 │  true │   1.0e-6 │   1.0e-6 │
│   1.0e-5 │  3 │ false │   1.0e-5 │   1.0e-5 │
│   0.0001 │  4 │  true │   0.0001 │   0.0001 │
│    0.001 │  5 │ false │    0.001 │    0.001 │
│     0.01 │  6 │  true │     0.01 │     0.01 │
│      0.1 │  7 │ false │      0.1 │      0.1 │
│      1.0 │  8 │  true │      1.0 │      1.0 │
│     10.0 │  9 │ false │     10.0 │     10.0 │
│  missing │ 10 │  true │     test │     -0.0 │
│   1000.0 │ 11 │ false │   1000.0 │      0.0 │
│  10000.0 │ 12 │  true │  10000.0 │  10000.0 │
│ 100000.0 │ 13 │ false │ 100000.0 │ 100000.0 │
│    1.0e6 │ 14 │  true │    1.0e6 │    1.0e6 │
│    1.0e7 │ 15 │ false │    1.0e7 │    1.0e7 │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Late to the party but, man, these really are pretty tables!

It is working for me now too. I had a package environment error. Sorry for the noise.