title: Pandas How to hide the header when the output need header as a condition to filter the result?
body: <h2><strong>Solution</strong></h2>
  
  <p>If you hide the header of the output. use the header = None option. And notice that just use it when you are going to print it. For the reason that if you set the header = None when you load the data, the name of the column is unusable to you, so you can't use it to filter the data or do something else.</p>
  
  <p>For example :</p>
  
  <p><code>print(ResDf.to_string(header = None))</code></p>
  
  <h2><strong>Update</strong></h2>
  
  <p>The output I want has no header. 
  For example the output is </p>
  
  <pre><code>  0   1  2   3  4   5  6   7  8   9   10 11 &lt;------------------column name
  3  b   7  a   4  b   2  b   6  b NaN  10  b
  8  a   8  a   6  b   2  c   4  a NaN  10  c
  </code></pre>
  
  <p>The output I want is </p>
  
  <p>------------without column name -------------------</p>
  
  <pre><code>3  b   7  a   4  b   2  b   6  b NaN  10  b
  8  a   8  a   6  b   2  c   4  a NaN  10  c
  </code></pre>
  
  <p>But it can't be done by using <code>header = none</code>, so I wonder how to make it? </p>
  
  <p>Thing is that if you set the <code>header = None</code> option, the column name can't be used as a condition to filter the data. Cuz there is no column name already. 
  For example I set the filter ( or called <em>mask</em>) as <code>mask = df[u'客户'].str.contains(Client, na=False) &amp; df[u'型号'].str.contains(GoodsType, na=False)</code>. If you set the header = None I think that there is no <code>型号</code> or <code>客户</code> in the dataframe, so It can't be used. So how to hide header when you still want to use the header to filter the output data?</p>
  
  <p>I want the pandas output without the <strong>header</strong>, but the output needs the header to filtered.</p>
  
  <p>Here is my code, I knew the trick to set the <code>header=None</code>, but I can't do that because the header still is used as a condition to filter the output. For example here I want the output with the <strong>'客户'</strong>(which is a column name) contain the certain word '<strong>Tom</strong>'(For example). If I use the <code>header = None</code> option, the '客户' will not be recognized. So how to get the output without the header, in my condition? </p>
  
  <pre><code># -*- coding: utf-8 -*-
  # -*- coding: gbk -*-
  import pandas as pd
  import numpy as np
  import sys
  import re
  import os
  
  import sys
  
  Client    = sys.argv[1]
  GoodsType = sys.argv[2]
  Weight    = sys.argv[3]
  
  script_dir = os.path.dirname(os.path.abspath(__file__))
  os.chdir(script_dir ) # change to the path that you already know
  
  pd.set_option('display.max_columns', 1000)
  # df = pd.read_excel("packagesum.xlsx", header = None) # '客户' will not be recognized when set the header to None
  df = pd.read_excel("packagesum.xlsx")
  # print(str(df.ix[:,u'客户经理':u'内袋标贴'][df[u'客户'].str.contains(Client, na = False)][df[u'型号'].str.contains(GoodsType, na = False)]))
  ResDf = df.ix[:,u'客户经理':u'留样'][df[u'客户'].str.contains(Client, na = False)][df[u'型号'].str.contains(GoodsType, na = False)]
  ResDf[u'重量'] = Weight
  print(str(ResDf))
  with open('GoodsTypeRes.txt', 'w') as the_file:
     the_file.write(str(ResDf))
  </code></pre>
  
  <p>This is the header of my excel file.</p>
  
  <p><a href="https://i.stack.imgur.com/jtSuV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jtSuV.png" alt="enter image description here"></a></p>