title: TypeError: 'int' object is not subscriptable Where is int?
body: <p>I got an error,<code>TypeError: 'int' object is not subscriptable</code> .
  I wanna connect 2 excel data 
  <a href="https://i.stack.imgur.com/QNndh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QNndh.png" alt="excel1"></a></p>
  
  <p><a href="https://i.stack.imgur.com/3cxTx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3cxTx.png" alt="excel2"></a>
  to User model.</p>
  
  <p>So my ideal output is</p>
  
  <pre><code>1|1|Blear|40|false|l|America|A|1
  2|5|Tom|23|true|o|UK|A|3
  3|9|Rose|52|false|m
  4|10|Karen||||Singapore|C|2
  </code></pre>
  
  <p>For example,Rose data of user_id＝3 is not in second excel, in that case being 2nd data empty is ok.I am thinking putting 2nd excel in dictionary type to User model.</p>
  
  <p>I searched the errors I thought this part <code>for data in data_dict</code> was wrong, I changed it  into <code>for data in range(len(data_dict))</code> but same error happens.I really cannot understand where is wrong.How should I fix this?</p>
  
  <p>Now views.py is </p>
  
  <pre><code>#coding:utf-8
  from django.shortcuts import render
  import xlrd
  from .models import User
  
  book = xlrd.open_workbook('../data/excel1.xlsx')
  sheet = book.sheet_by_index(1)
  
  def build_employee(employee):
    if employee == 'leader':
       return 'l'
    if employee == 'manager':
       return 'm'
    if employee == 'others':
       return 'o'
  
  for row_index in range(sheet.nrows):
    rows = sheet.row_values(row_index) 
    is_man = rows[4] != ""
    emp = build_employee(rows[5])
    user = User(user_id=rows[1], name_id=rows[2], name=rows[3], 
                age=rows[4],man=is_man,employee=emp)
    user.save()
  
  book2 = xlrd.open_workbook('../data/excel2.xlsx')
  sheet2 = book2.sheet_by_index(0)
  headers = sheet2.row_values(0)
  
  large_item = None
  data_dict = {}
  for row_index in range(sheet2.nrows):
      rows2 = sheet2.row_values(row_index)
      large_item = rows2[1] or large_item
  
      # Create dict with headers and row values
      row_data = {}
      for idx_col, value in enumerate(rows2):
          header_value = headers[idx_col]
          # Avoid to add empty column. A column in your example
          if header_value:
              row_data[headers[idx_col]] = value
              # Add row_data to your data_dict with
      data_dict[row_index] = row_data
      for row_number, row_data in data_dict.items():
          user1 = User.objects.filter(user_id = data['user_id']).exists()
          if user1:
              user1.__dict__.update(**data_dict)
              user1.save()
  </code></pre>
  
  <p>Now Traceback is</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
    File "/Users/XXX/testapp/app/views.py", line 123, in &lt;module&gt;
      user1 = User.objects.filter(user_id = row_data['user_id']).exists()
  KeyError: 'user_id'
  </code></pre>