<jupyter_start><jupyter_text>What's a Widget? A widget is a way of altering code through an GUI (graphical user interface) that combines buttons, sliders, and other features that, when manipulated, will alter Python code behind the scenes.   Why Widgets? Widgets are valuable to non-coders and coders alike. For non-coders, widgets can be a friendly way to play with and understand a new concept. If you're teaching about waves, it's one thing to show a few examples of sine waves with varying frequency and amplitude, and it's another to allow your user to adjust sliders for frequency/amplitude and see the wave change before their eyes in real time.For more experienced coders, widgets are a responsive alternative to manual labor. You can go through the cycle of adjusting parameter values in code, executing a cell, checking the output and repeating. Or you can use a widget to adjust those values through an interface, and have your output update and display automatically.   Widgets in Jupyter Widgets in Jupyter require the [ipywidgets library](https://github.com/jupyter-widgets/ipywidgets) which has a [really nice user guide](https://ipywidgets.readthedocs.io/en/stable/) which this chapter is based on. If you plan on spending a large amount of time working on widgets, the full tutorial will be your best bet, but if you want to get your feet wet as quickly as possible, I've attempted to extract the most useful and easy to use pieces of the library and share them here.   Installation<jupyter_code>!pip install ipywidgets
!jupyter nbextension enable --py widgetsnbextension<jupyter_output>Requirement already satisfied: ipywidgets in c:\users\rob\anaconda3\lib\site-packages (7.5.1)
Requirement already satisfied: widgetsnbextension~=3.5.0 in c:\users\rob\anaconda3\lib\site-packages (from ipywidgets) (3.5.1)
Requirement already satisfied: nbformat>=4.2.0 in c:\users\rob\anaconda3\lib\site-packages (from ipywidgets) (5.0.4)
Requirement already satisfied: ipython>=4.0.0; python_version >= "3.3" in c:\users\rob\anaconda3\lib\site-packages (from ipywidgets) (7.11.1)
Requirement already satisfied: ipykernel>=4.5.1 in c:\users\rob\anaconda3\lib\site-packages (from ipywidgets) (5.1.4)
Requirement already satisfied: traitlets>=4.3.1 in c:\users\rob\anaconda3\lib\site-packages (from ipywidgets) (4.3.3)
Requirement already satisfied: notebook>=4.4.1 in c:\users\rob\anaconda3\lib\site-packages (from widgetsnbextension~=3.5.0->ipywidgets) (6.0.3)
Requirement already satisfied: ipython-genutils in c:\users\rob\anaconda3\lib\site-packages (from nbformat>=4.2.0->ipywidgets) (0.2.0)
Requi[...]
{'fraction_non_alphanumeric': 0.08738980452280568, 'fraction_numerical': 0.02261402836335761, 'mean_word_length': 5.027713625866051, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '278771', 'license': 'Apache-2.0', 'n_tokens_mistral': 808, 'n_tokens_neox': 776, 'n_words': 312, 'path': 'tutorials/6.0 Widgets Intro.ipynb', 'repo_name': 'rbracco/nbpro', 'size': '2609'}