title: Is there a better way to update tableview model in PyQt5?
body: <p>I have a table with 6 columns which are populated by 4 different datasets. Column 1 and 3 are updated 10 times per second, column 2 is a static column updated once at initalisation and then never again. The other columns are updated less frequently. I am suffering from a bit of lag - not terrible but definately noticeable.</p>
  <p>To update the data I am using beingResetModel and endResetModel. From the documentation I understand this will clear the table and then call data for every visible (row, column). I am updating a lot of data I dont need to.</p>
  <p>Is there a way I can specify which columns I am changing in my update functions? Is it possible to update column2 once only and then never again?</p>
  <p>A simplified model is shown below, in reality the data structures are different and the indexing is more complicated for some columns</p>
  <pre><code>class TableModel(PyQt5.QtCore.QAbstractTableModel):
      def __init__(self, specs, length = 100000, parent=None):
          super().__init__(parent)
          self.default_length = length
  
          self.initData()
          
  
      def rowCount(self, parent=PyQt5.QtCore.QModelIndex()):
          return self.default_length
  
      def columnCount(self, parent=PyQt5.QtCore.QModelIndex()):
          return 6
  
          
      def update_d1(self, dat1):
          #changes data in column 1 and 3
          #data updates 10x per second
          self.beginResetModel()
          self.dat1 = dat1
          self.endResetModel()
  
      def update_d2(self, middle):
          #changes data in column 2
          #data updates once on initialisation, column doesnt change thereafter
          self.beginResetModel()
          self.middle = middle
          self.endResetModel()
  
      def update_d3(self, dat3):
          #changes data in column 5
          #data updates twice every second
          self.beginResetModel()
          self.dat3 = dat3
          self.endResetModel()
  
      def update_d4(self, dat4):
          #changes column 0 and 4
          # data updates sporadically
          self.beginResetModel()
          self.col0 = dat4['col0']
          self.col4 = dat4['col4']
          self.endResetModel()
  
      def data(self, index, role):
          if not index.isValid():
              return
          
          if role == PyQt5.QtCore.Qt.DisplayRole:
              if index.row() &lt; 0 or index.row() &gt;= self.default_length:
                  return None
              if index.column() == 0:
                  val = self.col0[index.row()]
                  return val
  
              if index.column() == 4:
                  val = self.col4[index.row()]
                  return val
  
              if index.column() == 2:
                  return self.middle[index.row()]
              if index.column() == 1:
                  val = self.dat1['col1'][index.row()]
                  return val
  
              if index.column() == 3:
                  val = self.dat1['col3'][index.row()]
                  return val
  
              if index.column() == 5:
                  #print(self.volume_profile)
                  val = self.dat3[index.row()]
                  return val
  </code></pre>
  <p><strong>EDIT</strong></p>
  <p>If I change to the below it will update only the 100th row in the first column.</p>
  <pre><code>def update_d1(self, dat1):
      col1_start_index = self.index(100, 0)
      col1_end_index = self.index(100, 0)
      self.data = data
      self.dataChanged.emit(col1_start_index, col1_end_index)
  </code></pre>
  <p>If I set the end index to the 101st row the whole table updates again rather than just 2 cells. What is the purpose of providing two indexes?</p>
  <pre><code>def update_d1(self, dat1):
      col1_start_index = self.index(100, 0)
      col1_end_index = self.index(101, 0)
      self.data = data
      self.dataChanged.emit(col1_start_index, col1_end_index)
  </code></pre>