Skip to content

Commit

Permalink
fixed #88 (DataFrame lost columns)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayang authored Sep 26, 2018
1 parent b064ad7 commit 740c8f4
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 740c8f4

Please sign in to comment.