@@ -1392,17 +1392,20 @@ def to_latex(self, buf=None, columns=None, col_space=None, colSpace=None,
13921392 if buf is None :
13931393 return formatter .buf .getvalue ()
13941394
1395- def info (self , verbose = True , buf = None , max_cols = None ):
1395+ def info (self , verbose = None , buf = None , max_cols = None ):
13961396 """
13971397 Concise summary of a DataFrame.
13981398
13991399 Parameters
14001400 ----------
1401- verbose : boolean, default True
1402- If False, don't print column count summary
1401+ verbose : {None, True, False}, optional
1402+ Whether to print the full summary.
1403+ None follows the `display.max_info_columns` setting.
1404+ True or False overrides the `display.max_info_columns` setting.
14031405 buf : writable buffer, defaults to sys.stdout
14041406 max_cols : int, default None
1405- Determines whether full summary or short summary is printed
1407+ Determines whether full summary or short summary is printed.
1408+ None follows the `display.max_info_columns` setting.
14061409 """
14071410 from pandas .core .format import _put_lines
14081411
@@ -1429,8 +1432,10 @@ def info(self, verbose=True, buf=None, max_cols=None):
14291432 max_rows = get_option ('display.max_info_rows' , len (self ) + 1 )
14301433
14311434 show_counts = ((len (self .columns ) <= max_cols ) and
1432- (len (self ) < max_rows ))
1433- if verbose :
1435+ (len (self ) < max_rows ))
1436+ exceeds_info_cols = len (self .columns ) > max_cols
1437+
1438+ def _verbose_repr ():
14341439 lines .append ('Data columns (total %d columns):' %
14351440 len (self .columns ))
14361441 space = max ([len (com .pprint_thing (k )) for k in self .columns ]) + 4
@@ -1442,22 +1447,33 @@ def info(self, verbose=True, buf=None, max_cols=None):
14421447 if len (cols ) != len (counts ): # pragma: no cover
14431448 raise AssertionError ('Columns must equal counts (%d != %d)' %
14441449 (len (cols ), len (counts )))
1445- tmpl = "%s non-null %s"
1450+ tmpl = "%s non-null %s"
14461451
14471452 dtypes = self .dtypes
14481453 for i , col in enumerate (self .columns ):
14491454 dtype = dtypes [col ]
14501455 col = com .pprint_thing (col )
14511456
1452- count = ""
1457+ count = ""
14531458 if show_counts :
14541459 count = counts .iloc [i ]
14551460
14561461 lines .append (_put_str (col , space ) +
14571462 tmpl % (count , dtype ))
1458- else :
1463+
1464+ def _non_verbose_repr ():
14591465 lines .append (self .columns .summary (name = 'Columns' ))
14601466
1467+ if verbose :
1468+ _verbose_repr ()
1469+ elif verbose is False : # specifically set to False, not nesc None
1470+ _non_verbose_repr ()
1471+ else :
1472+ if exceeds_info_cols :
1473+ _non_verbose_repr ()
1474+ else :
1475+ _verbose_repr ()
1476+
14611477 counts = self .get_dtype_counts ()
14621478 dtypes = ['%s(%d)' % k for k in sorted (compat .iteritems (counts ))]
14631479 lines .append ('dtypes: %s' % ', ' .join (dtypes ))
0 commit comments