Skip to content

BUG: regression in max_info_columns behaviour? #6939

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

Update:

  • max_info_columns should not behave the same as max_info_rows. If max_info_columns is exceeded, it should flip to short summary (as verbose=False)
  • we could add a keyword argument like show_counts (or another name) to specify if you want to show the non-null counts (to be able to override the max_info_rows option for a specific info call)

When you have more columns than specified in max_info_columns, df.info() will now still show all columns, but just without the information about the number of null values:

In [1]: pd.__version__
Out[1]: '0.13.1-656-gf30278e'

In [4]: df.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Data columns (total 5 columns):
0    5 non-null float64
1    5 non-null float64
2    5 non-null float64
3    5 non-null float64
4    5 non-null float64
dtypes: float64(5)

In [5]: df.info(verbose=False)
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Columns: 5 entries, 0 to 4
dtypes: float64(5)

In [6]: pd.options.display.max_info_columns = 4

In [7]: df.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Data columns (total 5 columns):
0    float64
1    float64
2    float64
3    float64
4    float64
dtypes: float64(5)

while previously in 0.13 this gave the same behaviour as for info(verbose=False):

In [15]: pd.__version__
Out[15]: '0.13.0'

In [16]: pd.options.display.max_info_columns = 4

In [17]: df.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Columns: 5 entries, 0 to 4
dtypes: float64(5)

which seems much more logical to me.

I suppose this is related to #5682, which added the behaviour to also show the dtype per column.

Update: it was deliberately added in #5974

Metadata

Metadata

Assignees

No one assigned

    Labels

    Output-Formatting__repr__ of pandas objects, to_stringRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions