Python ipywidgets和pandas数据帧
如何从@interact函数中为下一个单元格获取数据帧? 我的交互功能如下所示:Python ipywidgets和pandas数据帧,python,pandas,jupyter-notebook,ipywidgets,Python,Pandas,Jupyter Notebook,Ipywidgets,如何从@interact函数中为下一个单元格获取数据帧? 我的交互功能如下所示: @interact(eutPlace=eutPlaces) def selectByEut (eutPlace): rdsTable = tabelSisse.drop(['Id', 'Serial_number', 'User_modified'], axis='columns') rdsTable = rdsTable.loc[rdsTable['EUT_place'] == eutPlace]
@interact(eutPlace=eutPlaces)
def selectByEut (eutPlace):
rdsTable = tabelSisse.drop(['Id', 'Serial_number', 'User_modified'], axis='columns')
rdsTable = rdsTable.loc[rdsTable['EUT_place'] == eutPlace]
print(rdsTable.shape)
return rdsTable
找到了一个解决办法。使用interactive而不是@interact
def selectByEut (eutPlace):
rdsTable = tabelSisse.drop(['Id', 'Serial_number', 'User_modified'], axis='columns')
rdsTable = rdsTable.loc[rdsTable['EUT_place'] == eutPlace]
display(rdsTable)
return rdsTable
intrFilt = interactive(selectByEut, eutPlace=eutPlaces)
intrFilt
在下一个单元格中,我可以通过以下方式获得结果数据帧:
reducedTable = intrFilt.result