4

When I try to print the columns,

print dataframe.columns

it shows me

Index([u'Id', u'Guid', u'HardDisksInfo', u'ServerVersion', u'Email',
       u'BackupServer', u'DataSizeQuota', u'HostRamSize', u'CpuModel',
       u'CpuSpeed',
       ...
       u'Post_Month', u'Geography', u'Region', u'Budget_Region',
       u'Product_Family', u'Product_Name', u'Product_Version', u'License_Type',
       u'Language', u'row_num'],
      dtype='object', length=131)

How do I make it shows all without the ...?

1 Answers1

8

You need set display.max_seq_items to None or some value higher as 100 - see docs:

Option: display.max_seq_items
Default: 100

Function: when pretty-printing a long sequence, no more then max_seq_items will be printed. If items are omitted, they will be denoted by the addition of ”...” to the resulting string. If set to None, the number of items to be printed is unlimited.

idx = [u'Id', u'Guid', u'HardDisksInfo', u'ServerVersion', u'Email',
       u'BackupServer', u'DataSizeQuota', u'HostRamSize', u'CpuModel',
       u'CpuSpeed',
       
       u'Post_Month', u'Geography', u'Region', u'Budget_Region',
       u'Product_Family', u'Product_Name', u'Product_Version', u'License_Type',
       u'Language', u'row_num']
idx = idx * 10
df = pd.DataFrame(columns=idx)

print (df.columns)
Index(['Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email', 'BackupServer',
       'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       ...
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num'],
      dtype='object', length=200)
      
#temporaly display all columns
with pd.option_context('display.max_seq_items', None):
    print (df.columns)
Index(['Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email', 'BackupServer',
       'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed', 'Post_Month',
       'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num', 'Id', 'Guid', 'HardDisksInfo', 'ServerVersion', 'Email',
       'BackupServer', 'DataSizeQuota', 'HostRamSize', 'CpuModel', 'CpuSpeed',
       'Post_Month', 'Geography', 'Region', 'Budget_Region', 'Product_Family',
       'Product_Name', 'Product_Version', 'License_Type', 'Language',
       'row_num'],
      dtype='object')
Community
  • 1
  • 1
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
  • 1
    I was surprised to find that this works for df.columns but not for df.dtypes. Is there a solution that will show the full output for dtypes? – greymatter Jun 03 '18 at 19:08
  • 2
    @graymatter same problem here, solved by setting 'display.max_rows'. See https://stackoverflow.com/questions/23168416/pandas-printing-all-dtypes – Jacopofar Dec 17 '18 at 11:41