ronisbr / PrettyTables.jl

Print data in formatted tables.
MIT License
404 stars 38 forks source link

saving the pretty_table as a variable ? #200

Closed korilium closed 1 year ago

korilium commented 1 year ago

Is it possible to save the output of the pretty_table function in a variable and so yes how do you do this.

Thanks in advance

korilium commented 1 year ago

never mind found a solution: https://discourse.julialang.org/t/export-dataframe-to-html-file/91941/4

ronisbr commented 1 year ago

Hi @korilium !

Sorry, I missed this notification!

If you want to save it to a variable as a string, you can do:

julia> a = rand(3, 3);

julia> str = pretty_table(String, a);

julia> print(str)
┌───────────┬──────────┬──────────┐
│    Col. 1 │   Col. 2 │   Col. 3 │
├───────────┼──────────┼──────────┤
│ 0.0885507 │ 0.136958 │ 0.748459 │
│  0.764241 │ 0.255541 │ 0.160431 │
│  0.666031 │  0.14121 │ 0.750606 │
└───────────┴──────────┴──────────┘