【问题标题】:ipywidgets and pandas dataframeipywidgets 和 pandas 数据框
【发布时间】:2021-02-17 22:36:46
【问题描述】:
如何从@interact 函数中获取下一个单元格的数据框?
我的交互函数如下所示:
@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
【问题讨论】:
标签:
python
pandas
jupyter-notebook
ipywidgets
【解决方案1】:
找到了一种解决方案。使用交互式而不是@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