Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (50.2k points)

I'm relatively new to using the PyCharm IDE and have been unable to find a way to better shape the output when in a built-in console session. I'm typically working with pretty wide dataframes, that would fit easily across my monitor, but the display is cutting and wrapping them much sooner than needed.

Does anyone know of a setting to change this behavior to take advantage of the full width of my screen?

Edit: I don't have enough reputation to post a screenshot, but the link is below: http://imgur.com/iiBK3iU

I would like to prevent it from wrapping after only a few columns (for example, the column 'ReadmitRate' should be immediate to the right of 'SNFDaysPerSNFCase')

1 Answer

0 votes
by (107k points)

Your main problem is related to the console session itself. The console tries to auto-detect the width of the display area, but when that fails it defaults to 80 characters. This behavior can be revoked with the following code:

import pandas as pd

desired_width = 320    

pd.set_option('display.width', desired_width)

Where you can set the desired_width to whatever your display as it will tolerate. 

If you want to learn more about Pycharm then visit this Python Course designed by the industrial experts.

Related questions

0 votes
0 answers
asked Jan 5, 2021 in Python by spec300 (120 points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...