2
0

polarsで全部表示したい時

Posted at

こんにちは、ひらきちです。

(pandasすら触ったことがないのですが)
業務上、polarsで分析することになり、
「データが全部表示されない!(省略される)」
となって困ったので、
ちょっと色々調べて、
やっとうまくいったので後学のためメモを残しておこうと思います。

Q&A

Q:polarsで出力したDataFrameを全部見たいのですが
A:こうやったらうまくいきました

import polars as pl

#
# polarsを使ってDataFrameを作る
# 
df = xxx

# 全部表示する
with pl.Config() as cfg: 
    cfg.set_tbl_cols(df.width);
    cfg.set_tbl_rows(df.height);
    print(df)

(私の環境では)うまくいかなかった

github copilot&chatGPTの提案手法

  • 提案手法
# 最大列数を30に設定
pl.options.display.max_columns = 30
print(df)
  • エラー(そもそもoptionsが存在しないらしい)
AttributeError: module 'polars' has no attribute 'options'

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0