title: Assigning Values to a Nested Dictionary Error
body: <p>I have data coming in that contains a Timestamp, and Open, High, Low, and Close values.</p>
  
  <p>I'm trying to organize it in a dictionary so that at each timestamp, there is a key holding the corresponding Open, High, Low and Close values.</p>
  
  <p>What I've done so far:</p>
  
  <p>I started by initialing an empty dictionary called <code>newest_bar</code>.</p>
  
  <p>Then, every time a new bar is added, I first set a new key called <code>'Timestamp'</code> that will contain the time for that new bar. Then from there I'm running a <code>for</code> loop, to nest the corresponding Open, High, Low and close values under that Timestamp.</p>
  
  <p>Here's my attempt:</p>
  
  <pre><code>def append(self, bar):
      key = ['Open', 'High', 'Low', 'Close']
      values = [bar.Open, bar.High, bar.Low, bar.Close]
      self.newest_bar['TimeStamp'] = bar.Timestamp
      for i, item in enumerate(key):
          self.newest_bar['TimeStamp'][item] = values[i]
  
      print(self.newest_bar)
  </code></pre>
  
  <p>However I keep getting this error which is telling me that I'm prob not doing the key assignment correctly. </p>
  
  <blockquote>
    <p>TypeError: 'pywintypes.datetime' object does not support item assignment</p>
  </blockquote>
  
  <p>An example of the data:</p>
  
  <pre><code>Timestamp: 2019-07-17 10:58:00+00:00
  Open: 1.8877
  High: 1.8878
  Low: 1.8871
  Close: 1.8878
  </code></pre>
  
  <p>Example of the output</p>
  
  <pre><code>{'TimeStamp': '2019-07-17 10:58:00+00:00' 
          {'Open":1.8877, 'High':1.8878, 'Low':1.8871, 'Close':1.8878}
  </code></pre>