title: Saving one dataframe to multiple sheets in the same Excel
body: <p>Have a data frame and based off the sub headers for that data-frame, want to save to different sheets in the same csv file.  </p>
  
  <p>Tried writer.  </p>
  
  <pre><code>from bs4 import BeautifulSoup as soup
  import urllib.request
  import pandas as pd
  import pandas_datareader as pdr
  from pandas import ExcelWriter
  
  list = ['MDB', 'SQ', 'GOOS', 'NVDA', 'AMZN', 'ENPH', 'TEAM', 'TWLO', 'ZM']
  #print (list[1])
  #xls_path = '/Users/tony/documents/Python_Projects/stock_prices.csv'
  
  writer = pd.ExcelWriter("test_prices.csv", engine='xlsxwriter')
  
  
  for item in list:
      print (item)
  
  for item in list:
  #     earnings = pd.read_html('https://finance.yahoo.com/calendar/earnings?day=2019-06-13&amp;symbol=' + str(item))[0]
  #     latest_earnings = earnings[:4]
  #     print (latest_earnings)
      print ('\n This is the price for:' + str(item) + '\n')    
      prices = pdr.get_data_yahoo(item)[-30:]
  #     writer = prices.ExcelWriter("stock_prices.xlsx", engine='xlsxwriter')
  
  #         def save_xls(xls_path):
  #             with ExcelWriter(xls_path) as writer:
  #                 for n, df in enumerate(list_dfs):
  #                     df.to_excel(writer,'sheet%s' % n)
  
  #         writer.save()
  
  #     writer = ExcelWriter(xls_path)
  # #         for n, df in enumerate(df_list):
  #     df.to_excel(writer, item)
  
      print (prices)
  
  #     names = df['name'].unique().tolist()
  
  # writer = pandas.ExcelWriter("MyData.xlsx", engine='xlsxwriter')
  
  # for myname in names:
  #     mydf = df.loc[df.name==myname]
      prices.to_excel(writer, item)
  
  writer.save()
  </code></pre>
  
  <p>Traceback:</p>
  
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-20-f407b2c5f3fe&gt; in &lt;module&gt;()
        9 #xls_path = '/Users/tony/documents/Python_Projects/stock_prices.csv'
       10 
  ---&gt; 11 writer = pd.ExcelWriter("test_prices.csv", engine='xlsxwriter')
       12 
       13
  </code></pre>