小编Anw*_*ath的帖子

在 ipython-widgets 中启用多选

我有一个发展问题。我需要能够使用 ipython-widgets 从 python 的下拉菜单中同时选择多个项目。到目前为止,我已经能够在单选项小部件菜单中选择一个选项,选择后将绘制其相应的统计数据。我已将我的代码粘贴在下面,如果您能帮助我,我将不胜感激。

import numpy as np
import pandas as pd
import ipywidgets as widgets
import matplotlib.pyplot as plt
import panel as pn
pn.extension()


classes= widgets.Dropdown(
description='Products:',
options= list(output_table.class_m.unique())
)


start_year = widgets.BoundedFloatText(
    value=output_table.year.min(),
    min=output_table.year.min(),
    max=output_table.year.max(),
    step=1,
    description='Start Year:',
    disabled=False,
    color='black'
)
end_year = widgets.BoundedFloatText(
    value=output_table.year.max(),
    min=output_table.year.min(),
    max=output_table.year.max(),
    step=1,
    description='End Year:',
    disabled=False,
    color='black'
)


output=widgets.Output()

def response(name, start, end):
    name = classes.value
    output.clear_output()
    df2 = output_table.copy()
   # Filter between min and max years (inclusive)
    df2 = df2[(df2.year >= …
Run Code Online (Sandbox Code Playgroud)

ipython jupyter-notebook ipywidgets

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

ipython ×1

ipywidgets ×1

jupyter-notebook ×1