title: Python - have a function output multiple data frames
body: <p>I would like to achieve the following.</p>
  <ol>
  <li>I would like the function to output a separate data frame for each stock for example</li>
  <li>I would like to save each data frame to a separate csv</li>
  </ol>
  <p>the code doesnt work and i am unable to output the and save the separate csvs. Can you help me output separate dataframes and export the respective CSVS?</p>
  <pre><code>    def getdata(stock: str):
          # Company Quote Group of Items
          company_quote = requests.get(f&quot;https://financialmodelingprep.com/api/v3/quote/{stock}?apikey=demo&quot;)
          company_quote = company_quote.json()
          share_price = float(&quot;{0:.2f}&quot;.format(company_quote[0]['price']))
          
          # Balance Sheet Group of Items    
          BS = requests.get(f&quot;https://financialmodelingprep.com/api/v3/income-statement/{stock}?period=quarter&amp;limit=400&amp;apikey=demo&quot;)
          BS = BS.json()
          #Total Debt
          debt = float(&quot;{0:.2f}&quot;.format(float(BS[0]['totalDebt'])/10**9))
          #Total Cash
          cash = float(&quot;{0:.2f}&quot;.format(float(BS[0]['cashAndShortTermInvestments'])/10**9))
         
          # Income Statement Group of Items
          IS = requests.get(f&quot;https://financialmodelingprep.com/api/v3/income-statement/{stock}?period=quarter&amp;limit=400&amp;apikey=demo&quot;)
          IS = IS.json()
          # Most Recent Quarterly Revenue
          qRev = float(&quot;{0:.2f}&quot;.format(float(IS[0]['revenue'])/10**9))
         
          # Company Profile Group of Items
          company_info = requests.get(f&quot;https://financialmodelingprep.com/api/v3/profile/{stock}?apikey=demo&quot;)
          company_info = company_info.json()
          # Chief Executive Officer
          ceo = (company_info[0]['ceo'])
          return (share_price, cash, debt, qRev, ceo)
      
      stocks = ('AAPL')
      d = {}
      for stock in stocks:
          df[stock] = pd.DataFrame(getdata, columns=['Share Price','Total Cash', 'Total Debt', 'Q3 2019 Revenue', 'CEO'], index=tickers)
      print(d)
  </code></pre>