Skip to content

Commit

Permalink
Merge pull request #92 from ayang/master
Browse files Browse the repository at this point in the history
fixed #88 (DataFrame lost columns)
  • Loading branch information
uvemas authored Sep 26, 2018
2 parents b064ad7 + 740c8f4 commit 9e10243
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vitables/vttables/df_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def columnCount(self, index=QtCore.QModelIndex()):
Overrides should return 0 for valid indices if no children exist)
or the number of the total *columns* exposed by the model.
"""
return 0 if index.isValid() else self.numcols
return 0 if index.isValid() else self.numcols + self._nheaders[1]

def rowCount(self, index=QtCore.QModelIndex()):
"""
Expand All @@ -163,7 +163,7 @@ def rowCount(self, index=QtCore.QModelIndex()):
or the number of the total *columns* exposed by the model.
"""

return 0 if index.isValid() else self.numrows
return 0 if index.isValid() else self.numrows + self._nheaders[0]

def loadData(self, start, length):
"""Load the model with fresh chunk from the underlying leaf.
Expand Down Expand Up @@ -254,7 +254,7 @@ def data(self, index, role=Qt.DisplayRole):

if is_index:
if role == Qt.DisplayRole:
val = df.index[row]
val = df.index[row - n_columns]
if n_index > 1:
val = val[col]
return str(val)
Expand All @@ -266,7 +266,7 @@ def data(self, index, role=Qt.DisplayRole):

if is_columns:
if role == Qt.DisplayRole:
val = df.columns[col]
val = df.columns[col - n_index]
if n_columns > 1:
val = val[row]
return str(val)
Expand Down

0 comments on commit 9e10243

Please sign in to comment.