我想从用户那里获取jupyter中的输入文本。 这样的输入应该是csv、逗号分隔的值
根据这些值,我想生成一个交互式ipysheet,它依赖于另一个数据帧数据和用户输入
所以:
a) 用户输入。
b) ipysheet=f(用户输入)过滤df
c) 最终结果=f(ipysheet)
在前两个步骤中,我已经无法使事情正常进行
from ipysheet import from_dataframe, to_dataframe
from ipywidgets import *
df = pd.DataFrame(np.random.randint(0,10,size=(10, 4)), columns=list('ABCD'))
csv = ipywidgets.Text(value='',
placeholder = 'type here',
description = 'csv:',
disabled = False)
def submit(user_input):
list=user_input.split(',')
# here do calculations extracting data from df
for i,word in enumerate(list):
print(i,word)
# if I would get this running here I would create the ipysheet like so:
sheet = from_dataframe(df)
display(csv)
widgets.interact(submit,user_input=csv)
第一:我无法链接文本输入和提交功能
第二:在提交功能中,访问df的唯一方法是使用全局df
第三,可以链接两个iPysheet
目前没有回答
相关问题 更多 >
编程相关推荐