title: Can't figure out "AttributeError: 'NoneType' object has no attribute 'to_excel'"
body: <p>I am using Python 3.6 in Spyder. I am trying to insert a column before all of the other columns in an excel spread sheet and put the date in that column, in this case &quot;2010-01&quot;. When I run the code I get the error ;&quot;AttributeError: 'NoneType' object has no attribute 'to_excel'&quot;;.</p>
  <pre><code>import os
  import pandas as pd
  
  df = []
  for f in ['C:\\file.xls']:
      data = pd.read_excel(f, 'dspPrintOrExcel')
      data.index = [os.path.basename(f)]*len(data)
  
  class Column(object):
          def Date(self):
              print (&quot;2010-01&quot;)
  
  thing = Column()
  
  df = df.insert(0, thing.Date)
  df.to_excel(&quot;C:\\file2.xls&quot;)
  </code></pre>