赛派号

家用冰箱有必要买一级能效 [FIXED] How to stop Python from truncating print statements? ~ PHPFixing

[FIXED] How to stop Python from truncating print statements?

 September 16, 2022     pandas, printing, python     No comments   

Issue

I he a print statement that prints a very long big Pandas DataFrame series out, but I need all the information. When printing, Python gives

0 [{This is a long stateme.....}] 1 [{This is a long stateme.....}]

and terminates the print statement with dots.

I want to see the entire print statement without Python terminating it short, is there a setting to change to let print statements print infinite values?

Solution

Pandas allows options to see a set number of rows, as well as width

pd.set_option("display.max_rows", n) pd.set_option("display.expand_frame_repr", True) pd.set_option('display.width', 1000)

To increase the number of characters printed per column, use:

pd.set_option("display.max_colwidth", max_characters)

By default, a column only prints up to 50 characters, this option allows you to print an max_characters amount of characters.

See the docs below:

https://pandas.pydata.org/docs/user_guide/options.html

Answered By - Christina Stebbins Answer Checked By - Senaida (PHPFixing Volunteer) Share This:    Facebook Twitter Stumble Digg

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lsinopec@gmail.com举报,一经查实,本站将立刻删除。

上一篇 没有了

下一篇没有了