Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (47.6k points)

Is there a way to widen the display of output in either interactive or script-execution mode?

Specifically, I am using the describe() function on a Pandas dataframe. When the dataframe is 5 columns (labels) wide, I get the descriptive statistics that I want. However, if the dataframe has any more columns, the statistics are suppressed and something like this is returned:

>> Index: 8 entries, count to max

>> Data columns:

>> x1 8 non-null values

>> x2 8 non-null values

>> x3 8 non-null values

>> x4 8 non-null values

>> x5 8 non-null values

>> x6 8 non-null values

>> x7 8 non-null values

The "8" value is given whether there are 6 or 7 columns. What does the "8" refer to?

I have already tried dragging the IDLE window larger, as well as increasing the "Configure IDLE" width options, to no avail.

My purpose in using Pandas and describe() is to avoid using a second program like STATA to do basic data manipulation and investigation.

Python/IDLE 2.7.3

Pandas 0.8.1

Notepad++ 6.1.4 (UNICODE)

Windows Vista SP2

1 Answer

0 votes
by (106k points)

For the Pandas version 0.23.4 or above:-

Actually this is not necessary to expand the output display to see more columns because pandas auto detects the size of your terminal window if you set pd.options.display.width = 0

To get your desired output you can use pandas.set_option(optname, val):-

import pandas as pd pd.set_option('display.max_rows', 500) pd.set_option('display.max_columns', 500) pd.set_option('display.width', 1000)

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.1k users

Browse Categories