Skip to content

Commit c7ff72a

Browse files
committed
API: Enable changing the DataFrame in the DataFrameWidget.
1 parent 926991d commit c7ff72a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pandas/sandbox/qtpandas.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,18 @@ def __init__(self, dataFrame, parent=None):
8888
super(DataFrameWidget, self).__init__(parent)
8989

9090
self.dataModel = DataFrameModel()
91-
self.dataModel.setDataFrame(dataFrame)
92-
9391
self.dataTable = QTableView()
9492
self.dataTable.setModel(self.dataModel)
95-
self.dataModel.signalUpdate()
9693

9794
layout = QVBoxLayout()
9895
layout.addWidget(self.dataTable)
9996
self.setLayout(layout)
97+
# Set DataFrame
98+
self.setDataFrame(dataFrame)
10099

101-
def resizeColumnsToContents(self):
100+
def setDataFrame(self, dataFrame):
101+
self.dataModel.setDataFrame(dataFrame)
102+
self.dataModel.signalUpdate()
102103
self.dataTable.resizeColumnsToContents()
103104

104105
#-----------------stand alone test code

0 commit comments

Comments
 (0)