Issue
Consider the following example
pd.set_option('display.width', 50)
pl.DataFrame(data = np.random.randint(0,20, size = (10, 42)),
columns = list('abcdefghijklmnopqrstuvwxyz123456789ABCDEFG')).to_pandas()
You can see how nicely the columns are formatted, breaking a line after column k so that the full dataframe is printed in chunks in the console. This was controlled by the pandas width
argument above. I was not able to reproduce this behavior using polars
and all the format options
.
I have tried tweaking all possible settings:
pl.Config.set_tbl_cols(10)
pl.Config.set_fmt_str_lengths(10)
pl.Config.set_tbl_width_chars(70)
pl.Config.set_tbl_rows(2)
pl.Config.set_tbl_formatting('NOTHING')
pl.Config.set_tbl_column_data_type_inline(True)
pl.Config.set_tbl_dataframe_shape_below(True)
See below:
Any ideas? Thanks!
Solution
You can display all frame columns like so...
with pl.Config() as cfg:
cfg.set_tbl_cols(-1)
print(df)
...which will give you a good result on the given frame if you have sufficient terminal/console/output width available. If this isn't enough, I recommend making a feature request for this on the polars GitHub repository
Answered By - alexander-beedie
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.