python - PyQt QTableView prohibitively slow when scrolling with large data sets -


i have program loads profile csv file , displays data in table. loading of pandas data frame table fast because used custom model implementation of qabstracttablemodel, resizing of qtableview widget incredibly slow.

what can make resizing , scrolling smoother?

well, ended modifying custom table model made use numpy, , blazing fast.

use table model:

import numpy np  class pandasmodel(qtcore.qabstracttablemodel):     """     class populate table view pandas dataframe     """     def __init__(self, data, parent=none):         qtcore.qabstracttablemodel.__init__(self, parent)         self._data = np.array(data.values)         self._cols = data.columns         self.r, self.c = np.shape(self._data)      def rowcount(self, parent=none):         return self.r      def columncount(self, parent=none):         return self.c      def data(self, index, role=qtcore.qt.displayrole):         if index.isvalid():             if role == qtcore.qt.displayrole:                 return self._data[index.row(),index.column()]         return none       def headerdata(self, p_int, orientation, role):         if role == qtcore.qt.displayrole:             if orientation == qtcore.qt.horizontal:                 return self._cols[p_int]             elif orientation == qtcore.qt.vertical:                 return p_int         return none 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -