BUG: regression in max_info_columns behaviour? · Issue #6939 · pandas-dev/pandas (original) (raw)
Update:
max_info_columns
should not behave the same asmax_info_rows
. Ifmax_info_columns
is exceeded, it should flip to short summary (asverbose=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 themax_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