title: How to create dynamically named dictionary in Python?
body: <p>I am looking to chunk a bunch of data from a dataframe. In order to do so, I need to define a dynamic name to a dictionary. </p>
  
  <p>I would like to do something like:</p>
  
  <pre><code>dict_{}.format(VARIABLE_NAME) = {}
  </code></pre>
  
  <p>The above shown is an illegal operation. How can I go about defining a new dictionary name every time I need to create one? This is happening in a for loop, so I need to use dynamic dict names. Let me know if there is anything else I need to provide.</p>
  
  <p>Here is a snippet of the dataframe</p>
  
  <pre><code>   REFERENCE_CODE                                        TRANSLATION
  0      ladder_now                                                NaN
  1               0                                              xyzwu
  2               1                                              yxzuv
  3               2                                            asdfasd
  4               3                                             sdfsdh
  5               4                                             hghffg
  6               5                                            agfdhsj
  7               6                                            dfgasgf
  8               7                                             jfhkgj
  9               8                                           djfgjfhk
  10              9                                            dsfasys
  11             10                                            kghkfdy
  12             98                                          dsfhsuert
  13             99                                           wsdfadjs
  14  country_satis  Sa pangkagab’san, aoogma po ba kamo o dai naoo...
  15              1                                            Naoogma
  16              2                                        Dai naoogma
  17              8                           Dai aram (HUWAG BASAHIN)
  18              9                           Huminabo (HUWAG BASAHIN)
  19            NaN                                                NaN
  </code></pre>
  
  <p>I am trying to take chunks of data, as in, take <code>ladder_now</code> and all the values associated with it, then find <code>country_satis</code> and take those values, put them in a separate dictionary. Here is the logic I have.. just missing the dynamically created dict:</p>
  
  <pre><code>for index, row in df.iterrows():
      j = 0
      if isinstance(row['REFERENCE_CODE'], str):
          if j == 0:
              # fix dynamically changing dict here
              trend_dict = {}
              trend_dict[row['REFERENCE_CODE']] = row['TRANSLATION']
          else:
              j = 0
              # create new dynamically named dictionary
              next_dict = {}
              next_dict[row['REFERENCE_CODE']] = row['TRANSLATION']
      else:
          trend_dict[row['REFERENCE_CODE']] = row['TRANSLATION']
          j += 1
  </code></pre>
  
  <p>So essentially, I would like to have <code>dict_ladder_now</code> as one dictionary which contains all key, value pairs of everything below it until it reaches <code>country_satis</code>, and then a <code>dict_country_satis</code> as another.</p>