"""
This python module is the abstract definition of the Table view
for viewing the dataframe inside the GUI.
| Authors: Yaksh J Haranwala
"""
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
[docs]class TableModel(QtCore.QAbstractTableModel):
[docs] def __init__(self, data):
super(TableModel, self).__init__()
self._data = data
#
[docs] def data(self, index, role=Qt.DisplayRole):
if index.isValid():
if role == Qt.DisplayRole:
return str(self._data.iloc[index.row(), index.column()])
return None
[docs] def rowCount(self, parent=None):
return self._data.shape[0]
[docs] def columnCount(self, parent=None):
return self._data.shape[1]