title: Python Merging data from two sources - type error
body: <p>I'm trying to take an Excel file and add some columns from the file to an existing dictionary.  The dictionary is created by a product API, so I'm stuck with the formats I have.  </p>
  
  <p>The error message:  </p>
  
  <pre><code>File "C:\Users\me\RISC.py", line 143, in &lt;listcomp&gt;
      devices=[x for x in assets  if x['data'] 
  ['identifying_ip']==CMDB_device[ip_col]]
  TypeError: list indices must be integers or slices, not str
  </code></pre>
  
  <p>Here is the calling code:</p>
  
  <pre><code>    CMDBlist=self._csv_dict_list(CMDBfile) #imports .csv as ordered dict
      for CMDB_device in CMDBlist:           
          assets=device_list['assets'] #a dictionary that includes a list of devices
          devices=[x for x in assets  if x['data']['identifying_ip']==CMDB_device[ip_col]]
          if devices.length()&gt;0: # We matched on IP...do work
  </code></pre>
  
  <p>Sample of data Structure for device_list</p>
  
  <pre><code>{
  "assets": [
    {
      "data": {
        "deviceid": 12581177603741,
        "devicetype": "Generic SNMP Device",
        "hostname": "myhost",
        "identifying_ip": "10.1.2.3",
        "ips": [
          {
            "ip": "10.1.2.3"
          }
        ],
      "scantime": "1531184292"
      },
      ...
  </code></pre>
  
  <p>My eyes just may be getting blurry from looking at this too long.  Any ideas on where I'm messing this up?</p>