title: How to loop through dataframes in dictionary? Python
body: <p>I stored multiple DataFrames in a dictionary,</p>
  
  <pre><code>df_dict = {product: product_df.drop(['productID', 'productName'],axis = 1).sort(['date'])
            for product, product_df in products}
  </code></pre>
  
  <p>The dictionary looks like this, </p>
  
  <pre><code>Key   Type      Size           Values
  1   DataFrame  (100,2)  Column names: date, sales
  2   DataFrame  (130,2)  Column names: date, sales
  3   DataFrame  (115,2)  Column names: date, sales
  4   DataFrame  (137,2)  Column names: date, sales
  </code></pre>
  
  <p>I would like to write a for loop to store each DataFrame forecasting results in a list or a dictionary. This is how I did it, the value in the dictionary is <code>DataFrames</code> and the key is <code>productID</code>  </p>
  
  <pre><code>a = []
  for key, value in df_dict:
      m = Prophet()
      m.fit(value)
      future = m.make_future_dataframe(periods = 365)
      forecast = m.predict(future)
      a.append(forecast)
  </code></pre>
  
  <p>However, in the list <code>a = []</code>, the index is reset rather than the keys in a dictionary. Is there any ways to store the results with keys as reference index?</p>