title: Why are my dates coming from the wrong dict?
body: <p>There is a dict with config for API requests.</p>
  
  <p>Type of request and dates are indicated.</p>
  
  <pre><code>yt_params = {
      "yt_standard": {
          "startDate": "2019-08-01",
          "endDate": "2019-08-20",
      },
  
  "yt_test": {
          "startDate": "2018-08-01",
          "endDate": "2018-08-20",
      }
  
  }
  </code></pre>
  
  <p>For every type of request, metrics and dimensions are written in a database, so I put them in lists</p>
  
  <p>requests_types list with pandas dfs with metadata for every request type, example</p>
  
  <pre><code>    request_type request_name     request_subtype
  0   yt_standard  views,likes      metric
  1   yt_standard  channel          dimension
  
  </code></pre>
  
  <p>I need to add them to the original dict and make a new one, or change yt_params like this</p>
  
  <pre><code>yt_params = {
      "yt_standard": {
          "ids": "channel==111",
          "startDate": "2019-08-01",
          "endDate": "2019-08-20",
          "metrics": "views,likes",
          "dimensions": "channel",
          "request_id": "1",
      }
  
  "yt_test": {
          "ids": "channel==111",
          "startDate": "2018-08-01",
          "endDate": "2018-08-20",
          "metrics": "views,comments",
          "dimensions": "channel",
          "request_id": "2",
      }
  
  }
  </code></pre>
  
  <p>So I ended up with this code so far:</p>
  
  <pre><code>#  initiate var for requests counting
  j = 0
  #  final dict
  data_finish = {}
  
  #  for every type
  for request in requests_types :
      j = j + 1
      #  get the name of it
      re_type = request['request_type'][0]
      #  get metrics dimensions
      params = request['request_name'].to_list()
  
      #  iterate over dict 
      for k, v in yt_params.items():
          data =  {
          # constant
          "ids": "channel==111",    
          # get dates
          "startDate": v['startDate'],
          "endDate": v['endDate'],
          # get meta
          "metrics": params[0],
          "dimensions": params[1],
          # add number of request
          "request_id" : j
  }
          # add data to dict
          data_finish['rt_' + request['request_type'][0]] = data
  </code></pre>
  
  <p>The result is</p>
  
  <pre><code>{'rt_yt_standard': {'ids': 'channel==111',
    'startDate': '2018-08-01',
    'endDate': '2018-08-20',
    'metrics': 'views,likes',
    'dimensions': 'channel',
    'request_id': 1},
  
   'rt_yt_test': {'ids': 'channel==111',
    'startDate': '2018-08-01',
    'endDate': '2018-08-20',
    'metrics': 'views,likes',
    'dimensions': 'channel',
    'request_id': 2}}
  
  </code></pre>
  
  <p>Everything is good but the dates are from the second request type. And this I can't get, while if I make such dict </p>
  
  <pre><code>dict_example = {}
  j = 0
  
  for k, v in yt_params.items():
      j = j + 1
      d = { 'sd': v['startDate'],
           'ed': v['endDate']}
  
      dict_example ['d' + str(j)] = d
  </code></pre>
  
  <p>It works ok:</p>
  
  <pre><code>{'d1': {'sd': '2019-08-01', 'ed': '2019-08-20'},
   'd2': {'sd': '2018-08-01', 'ed': '2018-08-20'}}
  
  </code></pre>