PrettyTables.jl icon indicating copy to clipboard operation
PrettyTables.jl copied to clipboard

Add option to print the table transposed

Open ronisbr opened this issue 5 years ago • 6 comments

Ref: https://github.com/JuliaData/DataFrames.jl/issues/2065

ronisbr avatar Nov 09 '20 11:11 ronisbr

@bkamins one question for later:

If I transpose the tables (think about DataFrames), what would become the header? The row numbers?

ronisbr avatar Nov 15 '20 01:11 ronisbr

@scls19fr Hi! Maybe you can also provide me some guidance since you are who requested the feature :)

ronisbr avatar Nov 15 '20 01:11 ronisbr

I think row numbers as headers unless they are turned off - then no header. I guess for column names and eltype (unless it is turned off) we can use some standard names. So I imagine something like:

2×2 DataFrame
 Row │ x        y       
     │ Float64  Float64 
─────┼──────────────────
   1 │     1.0      2.0
   2 │     2.0      3.0

getting printed as (but with the vertical bar moved after eltype - I do not know how to cleanly do it, but for sure it is doable given the flexibility PrettyTables.jl have :smile:):

Transposed 2×4 DataFrame
 name │ eltype   1        2       
──────┼───────────────────────────
 x    │ Float64      1.0      2.0
 y    │ Float64      2.0      3.0

bkamins avatar Nov 15 '20 07:11 bkamins

Hi @ronisbr and @bkamins

what @bkamins is showing looks good to me. but an other representation could be simply

Transposed 2×4 DataFrame
 Col       |  1        2       
───────────┼──────────────────────
 x Float64 |     1.0      2.0
 y Float64 |     2.0      3.0

s-celles avatar Nov 15 '20 08:11 s-celles

Any chance someone has time to push this one along? I think this would be great feature.

ablaom avatar Mar 08 '23 21:03 ablaom

Hi @ablaom !

It is on my TODO list :) I am just lacking time currently because I need to implement many modification in SatelliteToolbox.jl for a project at my work. However, if someone wants to try, after a huge rewrite, it shouldn't be that hard.

If nobody can implement that, I will put it on top of my priorities list.

ronisbr avatar Mar 08 '23 23:03 ronisbr