pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
29.25k stars 1.85k forks source link

Automatically adjust the number of columns printed for a DataFrame. #6105

Open arturdaraujo opened 1 year ago

arturdaraujo commented 1 year ago

Problem description

The default number of columns printed in Polars' DataFrame is 8. (pl.Config.set_tbl_cols(8)). I suggest making that number change dynamically. To exemplify this issue, the dataset below gets messy with columns' names and the also with the rows (and by "messy" I mean it uses more than 1 line).

print(daily_gaps)
Out[5]: 
┌───────────┬──────────┬────────┬──────────┬─────┬──────────┬────────────┬────────────┬────────────┐
│ id        ┆ date_tim ┆ ticker ┆ exchange ┆ ... ┆ gap      ┆ gap_from_p ┆ gap_from_p ┆ premkt_vol │
│ str       ┆ e        ┆ str    ┆ str      ┆     ┆ f64      ┆ revious_op ┆ re_previou ┆ ume        │
│           ┆ datetime ┆        ┆          ┆     ┆          ┆ en         ┆ s_close    ┆ i64        │
│           ┆ [ns]     ┆        ┆          ┆     ┆          ┆ f64        ┆ f64        ┆            │
╞═══════════╪══════════╪════════╪══════════╪═════╪══════════╪════════════╪════════════╪════════════╡
│ 2008-04-2 ┆ 2008-04- ┆ SOHU   ┆ NASDAQ   ┆ ... ┆ 0.13085  ┆ 0.156126   ┆ 0.203966   ┆ 319251     │
│ 8_SOHU    ┆ 28       ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│           ┆ 00:00:00 ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│ 2008-05-0 ┆ 2008-05- ┆ SLM    ┆ NASDAQ   ┆ ... ┆ 0.048024 ┆ 0.119124   ┆ 0.362159   ┆ 169150     │
│ 2_SLM     ┆ 02       ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│           ┆ 00:00:00 ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│ 2008-05-0 ┆ 2008-05- ┆ ONNN   ┆ NASDAQ   ┆ ... ┆ 0.191271 ┆ 0.200517   ┆ 0.205195   ┆ 2586702    │
│ 7_ONNN    ┆ 07       ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│           ┆ 00:00:00 ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│ 2008-05-0 ┆ 2008-05- ┆ CROX   ┆ NASDAQ   ┆ ... ┆ 0.248062 ┆ 0.234421   ┆ 0.243028   ┆ 2102422    │
│ 8_CROX    ┆ 08       ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│           ┆ 00:00:00 ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│ ...       ┆ ...      ┆ ...    ┆ ...      ┆ ... ┆ ...      ┆ ...        ┆ ...        ┆ ...        │
│ 2022-11-2 ┆ 2022-11- ┆ XGN    ┆ NASDAQ   ┆ ... ┆ 0.111765 ┆ 0.453846   ┆ 0.482353   ┆ 288893     │
│ 5_XGN     ┆ 25       ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│           ┆ 00:00:00 ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│ 2022-11-2 ┆ 2022-11- ┆ MANU   ┆ NYSE     ┆ ... ┆ 0.061571 ┆ 0.216545   ┆ 0.338688   ┆ 970697     │
│ 5_MANU    ┆ 25       ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│           ┆ 00:00:00 ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│ 2022-11-2 ┆ 2022-11- ┆ AXSM   ┆ NASDAQ   ┆ ... ┆ 0.248373 ┆ 0.266869   ┆ 0.264161   ┆ 718156     │
│ 8_AXSM    ┆ 28       ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│           ┆ 00:00:00 ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│ 2022-11-3 ┆ 2022-11- ┆ XPEV   ┆ NYSE     ┆ ... ┆ 0.160673 ┆ 0.173077   ┆ 0.23589    ┆ 6514978    │
│ 0_XPEV    ┆ 30       ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
│           ┆ 00:00:00 ┆        ┆          ┆     ┆          ┆            ┆            ┆            │
└───────────┴──────────┴────────┴──────────┴─────┴──────────┴────────────┴────────────┴────────────┘
shape: (9704, 19)

The counterpart Pandas somehow does change it depending on the width of the column's name and/or the rows' width. The same dataset above prints 5 columns (if you count with the index). All the columns' names use only one line as well as the rows.

print(daily_gaps.to_pandas())
Out[7]: 
                   id  date_time  ... gap_from_pre_previous_close premkt_volume
0     2008-04-28_SOHU 2008-04-28  ...                    0.203966        319251
1      2008-05-02_SLM 2008-05-02  ...                    0.362159        169150
2     2008-05-07_ONNN 2008-05-07  ...                    0.205195       2586702
3     2008-05-08_CROX 2008-05-08  ...                    0.243028       2102422
4     2008-05-13_CSIQ 2008-05-13  ...                    0.323129       1252860
              ...        ...  ...                         ...           ...
9699  2022-11-23_MANU 2022-11-23  ...                    0.258806        275740
9700   2022-11-25_XGN 2022-11-25  ...                    0.482353        288893
9701  2022-11-25_MANU 2022-11-25  ...                    0.338688        970697
9702  2022-11-28_AXSM 2022-11-28  ...                    0.264161        718156
9703  2022-11-30_XPEV 2022-11-30  ...                    0.235890       6514978

[9704 rows x 19 columns]

I can't emphasize how much I like this package, this would be just a nice tweak on usability and design.

arturdaraujo commented 1 year ago

Just to make a few "design justifications" for this enhancement:

  1. This will make the dataset more compact, which improves usability (in this case, from 32 lines to 14 lines on the console). Check DataFrame 1.
  2. It will avoid edge cases where a column's row width prolongs the dataset's length by a lot. Check DataFrame 2.
  3. The column dtype identification below the column's name will become more evident since the second row will always be a dtype.
#  DataFrame 1
print(daily_gaps)
Out[20]: 
┌─────────────────┬─────────────────────┬─────┬─────────────────────────────┬───────────────┐
│ id              ┆ date_time           ┆ ... ┆ gap_from_pre_previous_close ┆ premkt_volume │
│ str             ┆ datetime[ns]        ┆     ┆ f64                         ┆ i64           │
╞═════════════════╪═════════════════════╪═════╪═════════════════════════════╪═══════════════╡
│ 2008-04-28_SOHU ┆ 2008-04-28 00:00:00 ┆ ... ┆ 0.203966                    ┆ 319251        │
│ 2008-05-02_SLM  ┆ 2008-05-02 00:00:00 ┆ ... ┆ 0.362159                    ┆ 169150        │
│ 2008-05-07_ONNN ┆ 2008-05-07 00:00:00 ┆ ... ┆ 0.205195                    ┆ 2586702       │
│ 2008-05-08_CROX ┆ 2008-05-08 00:00:00 ┆ ... ┆ 0.243028                    ┆ 2102422       │
│ ...             ┆ ...                 ┆ ... ┆ ...                         ┆ ...           │
│ 2022-11-25_XGN  ┆ 2022-11-25 00:00:00 ┆ ... ┆ 0.482353                    ┆ 288893        │
│ 2022-11-25_MANU ┆ 2022-11-25 00:00:00 ┆ ... ┆ 0.338688                    ┆ 970697        │
│ 2022-11-28_AXSM ┆ 2022-11-28 00:00:00 ┆ ... ┆ 0.264161                    ┆ 718156        │
│ 2022-11-30_XPEV ┆ 2022-11-30 00:00:00 ┆ ... ┆ 0.23589                     ┆ 6514978       │
└─────────────────┴─────────────────────┴─────┴─────────────────────────────┴───────────────┘
shape: (9704, 19)
#  DataFrame 2
print(daily_gaps)
Out[24]: 
┌───┬─────────┬────────┬────────┬───────┬─────┬────────────┬───┬────────────┬────────────┬────────────┐
│ i ┆ date_ti ┆ ticker ┆ exchan ┆ open  ┆ ... ┆ pre_pre_pr ┆ g ┆ gap_from_p ┆ gap_from_p ┆ premkt_vol │
│ d ┆ me      ┆ str    ┆ ge     ┆ f64   ┆     ┆ evious_clo ┆ a ┆ revious_op ┆ re_previou ┆ ume        │
│ s ┆ datetim ┆        ┆ str    ┆       ┆     ┆ se         ┆ p ┆ en         ┆ s_close    ┆ i64        │
│ t ┆ e[ns]   ┆        ┆        ┆       ┆     ┆ f64        ┆ f ┆ f64        ┆ f64        ┆            │
│ r ┆         ┆        ┆        ┆       ┆     ┆            ┆ 6 ┆            ┆            ┆            │
│   ┆         ┆        ┆        ┆       ┆     ┆            ┆ 4 ┆            ┆            ┆            │
╞═══╪═════════╪════════╪════════╪═══════╪═════╪════════════╪═══╪════════════╪════════════╪════════════╡
│ 2 ┆ 2008-04 ┆ SOHU   ┆ NASDAQ ┆ 69.83 ┆ ... ┆ 57.8       ┆ 0 ┆ 0.156126   ┆ 0.203966   ┆ 319251     │
│ 0 ┆ -28 00: ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 0 ┆ 00:00   ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 8 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 3 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 0 ┆            ┆            ┆            │
│ 0 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 8 ┆            ┆            ┆            │
│ 4 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 5 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 8 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ _ ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ S ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ O ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ H ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ U ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 2 ┆ 2008-05 ┆ SLM    ┆ NASDAQ ┆ 20.95 ┆ ... ┆ 15.11      ┆ 0 ┆ 0.119124   ┆ 0.362159   ┆ 169150     │
│ 0 ┆ -02 00: ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 0 ┆ 00:00   ┆        ┆        ┆       ┆     ┆            ┆ 0 ┆            ┆            ┆            │
│ 8 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 4 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 8 ┆            ┆            ┆            │
│ 0 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 0 ┆            ┆            ┆            │
│ 5 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 2 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 4 ┆            ┆            ┆            │
│ 0 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ _ ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ S ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ L ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ M ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 2 ┆ 2008-05 ┆ ONNN   ┆ NASDAQ ┆ 9.28  ┆ ... ┆ 7.72       ┆ 0 ┆ 0.200517   ┆ 0.205195   ┆ 2586702    │
│ 0 ┆ -07 00: ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 0 ┆ 00:00   ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 8 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 9 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 0 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 2 ┆            ┆            ┆            │
│ 5 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 7 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 0 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 7 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ _ ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ O ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ N ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ N ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ N ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 2 ┆ 2008-05 ┆ CROX   ┆ NASDAQ ┆ 12.48 ┆ ... ┆ 10.1184    ┆ 0 ┆ 0.234421   ┆ 0.243028   ┆ 2102422    │
│ 0 ┆ -08 00: ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 0 ┆ 00:00   ┆        ┆        ┆       ┆     ┆            ┆ 2 ┆            ┆            ┆            │
│ 8 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 4 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 8 ┆            ┆            ┆            │
│ 0 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 0 ┆            ┆            ┆            │
│ 5 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 6 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 2 ┆            ┆            ┆            │
│ 0 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 8 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ _ ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ C ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ R ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ O ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ X ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ . ┆ ...     ┆ ...    ┆ ...    ┆ ...   ┆ ... ┆ ...        ┆ . ┆ ...        ┆ ...        ┆ ...        │
│ . ┆         ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ . ┆         ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 2 ┆ 2022-11 ┆ XGN    ┆ NASDAQ ┆ 3.78  ┆ ... ┆ 2.78       ┆ 0 ┆ 0.453846   ┆ 0.482353   ┆ 288893     │
│ 0 ┆ -25 00: ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 2 ┆ 00:00   ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 1 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 7 ┆            ┆            ┆            │
│ 1 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 6 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 5 ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 5 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ _ ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ X ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ G ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ N ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 2 ┆ 2022-11 ┆ MANU   ┆ NYSE   ┆ 20.0  ┆ ... ┆ 13.06      ┆ 0 ┆ 0.216545   ┆ 0.338688   ┆ 970697     │
│ 0 ┆ -25 00: ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 2 ┆ 00:00   ┆        ┆        ┆       ┆     ┆            ┆ 0 ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 6 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 1 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 5 ┆            ┆            ┆            │
│ 1 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 7 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 5 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ _ ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ M ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ A ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ N ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ U ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 2 ┆ 2022-11 ┆ AXSM   ┆ NASDAQ ┆ 70.97 ┆ ... ┆ 57.23      ┆ 0 ┆ 0.266869   ┆ 0.264161   ┆ 718156     │
│ 0 ┆ -28 00: ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 2 ┆ 00:00   ┆        ┆        ┆       ┆     ┆            ┆ 2 ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 4 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 8 ┆            ┆            ┆            │
│ 1 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 3 ┆            ┆            ┆            │
│ 1 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 7 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 3 ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 8 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ _ ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ A ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ X ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ S ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ M ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 2 ┆ 2022-11 ┆ XPEV   ┆ NYSE   ┆ 8.54  ┆ ... ┆ 7.07       ┆ 0 ┆ 0.173077   ┆ 0.23589    ┆ 6514978    │
│ 0 ┆ -30 00: ┆        ┆        ┆       ┆     ┆            ┆ . ┆            ┆            ┆            │
│ 2 ┆ 00:00   ┆        ┆        ┆       ┆     ┆            ┆ 1 ┆            ┆            ┆            │
│ 2 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 6 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 0 ┆            ┆            ┆            │
│ 1 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 6 ┆            ┆            ┆            │
│ 1 ┆         ┆        ┆        ┆       ┆     ┆            ┆ 7 ┆            ┆            ┆            │
│ - ┆         ┆        ┆        ┆       ┆     ┆            ┆ 3 ┆            ┆            ┆            │
│ 3 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ 0 ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ _ ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ X ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ P ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ E ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
│ V ┆         ┆        ┆        ┆       ┆     ┆            ┆   ┆            ┆            ┆            │
└───┴─────────┴────────┴────────┴───────┴─────┴────────────┴───┴────────────┴────────────┴────────────┘
shape: (9704, 19)
arturdaraujo commented 1 year ago

@alexander-beedie

arturdaraujo commented 2 months ago

Picking an automatic number of columns based on terminal length would greatly improve the visual aspect of polars as it tends to get messy when printing a df with multiple columns.

I created a PR a while back with a python solution while a Rust is not ready, maybe have a look?

https://github.com/pola-rs/polars/pull/7856/files

arturdaraujo commented 1 month ago

@stinodego this could be a great addition to polars package