python-3.x - Ipython 小部件下拉列表,包括 NaN 值
问题描述
我有一个 ipython 小部件下拉列表,其中包括 NaN:
from ipywidgets import widgets
import numpy as np
widgets.Dropdown(description='Choose this:', options=[None, 'a', 'b', np.nan])
当我尝试选择 NaN 时,出现以下错误:
StopIteration Traceback (most recent call last)
...
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
...
ValueError: nan not in array
During handling of the above exception, another exception occurred:
TraitError Traceback (most recent call last)
...
TraitError: Invalid selection: value not found
我删除了 Tracebacks,因为机器人迫使我添加更多细节,因为我的帖子“主要是代码”。
起初我以为我们只能在下拉列表中使用文字,但使用对象通常可以正常工作。NaN有什么特别之处?
解决方案
推荐阅读
- python-3.x - 根据 A 列和 B 列的内容创建 X1-Xn 列
- bayesian - r程序bayes.glmm在prep_call_sampler(对象)中给出错误错误
- php - 如何将视频作为“首映”上传到 Facebook
- laravel - 我正在尝试使用 laravel 8 在受训者表“身份”字段和预订表中的“受训者身份”字段之间创建一个外键
- android - 字符串末尾的正则表达式替换在 Kotlin for Android 中不起作用
- wpf - MaterialDesign PopUpBox 拖放 Wpf
- python - 如何更改用户的昵称,知道他们的 id,但不知道他们的成员对象(Discord.py)
- javascript - 优化 React 应用程序 - 仅根据 React [React.JS]
- angular-cli - 如何在 Angular --prod build 中修复“TypeError: undefined is not a constructor (evalating 'new Lt.Subject')”?与 --optimization=false 一起使用
- flutter - 在颤动中动态获取上下文大小