我不熟悉ipywidgets
,并尝试将此库中的interact
与数据帧结合使用。我的数据帧是:
df
KundenNR Kundengruppe Wertpapierart Erlös Kosten A Kosten B
1 1 A 100 30 10
1 1 B 200 30 15
1 1 C 300 30 20
我做了以下几点:
^{pr2}$这成功地给了我想要的结果,这意味着我看到了datframe,并且列Kosten A
被交互按钮改变了:
我真的很想知道如何将数据帧直接传递给函数,而不是创建它的副本。有解决办法吗?在
将dataframe作为参数传递给用
fixed
包装的函数。您应该能够在之后调用您的数据帧,并且由于您的交互而导致的任何更改都应该是永久的。在使用
fixed
伪小部件是向交互函数传递额外参数的一种方式,这些参数不显示为小部件。参见:https://ipywidgets.readthedocs.io/en/latest/examples/Using%20Interact.html#Fixing-arguments-using-fixed但是,
fixed
的实现非常简单(interaction.py
):因此,您可以编写自己的伪小部件
^{pr2}$fixed_copy
:它很好地显示了修改后的
df
,但之后,df
的值仍然是:相关问题 更多 >
编程相关推荐