{"id":26,"date":"2021-05-22T03:11:10","date_gmt":"2021-05-22T03:11:10","guid":{"rendered":"https:\/\/code-ml.com\/?p=26"},"modified":"2021-09-14T00:51:37","modified_gmt":"2021-09-14T00:51:37","slug":"introduction-to-widgets-in-jupyter-notebook-build-your-own-pandas-profiler","status":"publish","type":"post","link":"https:\/\/codeml.ai\/index.php\/2021\/05\/22\/introduction-to-widgets-in-jupyter-notebook-build-your-own-pandas-profiler\/","title":{"rendered":"Introduction to widgets in Jupyter notebook: Build your own Dashboard"},"content":{"rendered":"<p>Jupyter notebooks are an open document format based on JSON. It is one of the most used data science tools among data scientists. In Jupiter notebook, to change the output of the cell or to get desired value out of the cell we need to run it again, this can be tedious and error-prone work. To reduce these drawbacks, we can use create interactive widgets, these GUI widgets help make notebooks look lively and interactive. You can show results by using different widgets like buttons, sliders, drop-downs, etc.<br><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/user_guide.html\">ipywidgets<\/a> is the open-source library that helps us to embed those widgets in our Jupiter notebook. In this article will we learn and code basics widgets provided by the library and finally we will create a dashboard like <a href=\"https:\/\/github.com\/pandas-profiling\/pandas-profiling\">Pandas profiler<\/a> to showcase some information about our dataset.<\/p>\n<h3>Getting started<\/h3>\n<p>We need to first install the <strong>ipywidgets<\/strong> library. If you are using pip then type the command below to install the library.<\/p>\n\n\n<pre class=\"wp-block-verse\"><strong>All Code for the blog is present here - <\/strong><a href=\"https:\/\/github.com\/ahmadkhan242\/jupyter_widgets\/blob\/main\/jupyter_widgets.ipynb\" target=\"_blank\" rel=\"noreferrer noopener\">ahmadkhan242\/jupyter_widgets.ipynb<\/a>\n<strong>Google colab - <\/strong><a href=\"https:\/\/colab.research.google.com\/github\/ahmadkhan242\/jupyter_widgets\/blob\/main\/jupyter_widgets.ipynb\" target=\"_blank\" rel=\"noreferrer noopener\">colab\/ahmadkhan242\/jupyter_widgets.ipynb<\/a><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">pip install ipywidgets \n# To enable `ipywidgets`\njupyter nbextension enable --py widgetsnbextension<\/code><\/pre>\n\n\n\n<p>For conda environament :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">conda install -c conda-forge ipywidgets<\/code><\/pre>\n\n\n\n<h2>Let&#8217;s get started<\/h2>\n\n\n\n<p>We first need to import the module in our notebook, you can import as shown below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">import ipywidgets as widgets<\/code><\/pre>\n\n\n\n<h3><strong><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#IntSlider\" target=\"_blank\" rel=\"noreferrer noopener\">Sliders<\/a><\/strong><\/h3>\n\n\n\n<p>To use any widgets we first need to initialize the widgets and then display them using the display function from the `<strong>IPython.display<\/strong>` library.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">from IPython.display import display\nslider = widgets.IntSlider()\ndisplay(slider)<\/code><\/pre>\n\n\n\n<p>In the above code, we initialize the slider using default config, you can change the min and max values, also we can add description too.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">widgets.IntSlider(\n    min=0,\n    max=10,\n    step=1,\n    description='Slider:',\n    value=3\n)<\/code><\/pre>\n\n\n\n<h3><strong><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#ToggleButton\" target=\"_blank\" rel=\"noreferrer noopener\">Button<\/a><\/strong><\/h3>\n\n\n\n<p>Similar to what we did in slider, we need to first initialise the button widget and than display it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">btn = widgets.Button(description='Widget')\ndisplay(btn)<\/code><\/pre>\n\n\n\n<p>Currently, the button is doing nothing so we will add an event to the button. So when the button is pressed some event will get executed. We first create a function,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def button_eventhandler(obj):\n    print('Hello from the {} button!'.format(obj.description))<\/code><\/pre>\n\n\n\n<p>Now, we will bind the function to the button we created above using the button&#8217;s `<strong>on_click<\/strong>` method and display it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">btn.on_click(button_eventhandler)\ndisplay(btn)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/btn.gif\" alt=\"\" class=\"wp-image-38\" width=\"752\" height=\"250\"\/><figcaption>Button widget in action<\/figcaption><\/figure>\n\n\n\n<h3><strong><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#Dropdown\" target=\"_blank\" rel=\"noreferrer noopener\">Dropdown<\/a> <\/strong><\/h3>\n\n\n\n<p>For this section, we will use a dataset to explore other widgets. The data-set we are going to use is Titanic which can be downloaded from here &#8211; <a href=\"https:\/\/raw.githubusercontent.com\/datasciencedojo\/datasets\/master\/titanic.csv\">Link<\/a>. After downloading the dataset we will load the dataset into a data frame using the pandas library:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">import pandas as pd\nurl=\"https:\/\/raw.githubusercontent.com\/datasciencedojo\/datasets\/master\/titanic.csv\"\ndf = pd.read_csv(url)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"164\" src=\"https:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/df-1024x164.png\" alt=\"\" class=\"wp-image-41\" srcset=\"https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/df-1024x164.png 1024w, https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/df-300x48.png 300w, https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/df-768x123.png 768w, https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/df.png 1293w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>df.head()<\/figcaption><\/figure>\n\n\n\n<p>We will first initiate the dropdown widget with the options which is a list, here will define two options for our dropdown. First will be DF head, which shows us the head of the DataFrame, and second will be DF info, which will provide the information of the DataFrame. Let&#8217;s begin:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">dropdown = widgets.Dropdown(options =[\"DF head\", \"DF info\"])\ndisplay(dropdown)<\/code><\/pre>\n\n\n\n<p>The dropdown widget has a method called <strong>observe<\/strong> which checks on the change in the dropdown, it takes a function that will be executed when there is a change in the dropdown widget. To display the changes we will use the <strong>output widget<\/strong>. <\/p>\n\n\n\n<p><strong>Output widget &#8211; <\/strong>it is a special kind of widget with captures an output of one cell and can be displayed in another display. But here we will capture the output of the dropdown widget when we select different options.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">dropdown = widgets.Dropdown(options =[\"None\", \"DF head\", \"DF info\"])\noutput = widgets.Output()\ndef select(change):\n  output.clear_output()\n  if(change.new == 'None'):\n    with output:\n      display(\"Select an option\")\n  elif(change.new == 'DF head'):\n    with output:\n      display(df.head())\n  elif(change.new == 'DF info'):\n    with output:\n      display(df.info())\n  else:\n    with output:\n      display(\"Error: option not found\")\n  \ndropdown.observe(select, names=\"value\")\ndisplay(dropdown)\ndisplay(output)<\/code><\/pre>\n\n\n\n<div class=\"is-layout-flow wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/ezgif-2-9b074bf4f849-1024x403.gif\" alt=\"\" class=\"wp-image-88\" width=\"752\" height=\"504\"\/><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"is-layout-flow wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<div class=\"is-layout-flex wp-container-3 wp-block-columns\">\n<div class=\"is-layout-flow wp-block-column\">\n<h3><strong><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#Text\" title=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#Text\">Text <\/a><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#Text\" target=\"_blank\" rel=\"noreferrer noopener\" title=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#Text\">field<\/a><\/strong><\/h3>\n\n\n\n<p>There are different ways to initiate text field, listed below:<\/p>\n\n\n\n<ol><li><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#Text\" target=\"_blank\" rel=\"noreferrer noopener\">widgets.Text()<\/a><\/li><li><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#IntText\" target=\"_blank\" rel=\"noreferrer noopener\">widgets.IntText()<\/a><\/li><li><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#FloatText\" target=\"_blank\" rel=\"noreferrer noopener\">widgets.FloatText()<\/a><\/li><li><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#BoundedIntText\" target=\"_blank\" rel=\"noreferrer noopener\">widgets.BoundedIntText()<\/a> and <a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#BoundedFloatText\" target=\"_blank\" rel=\"noreferrer noopener\">widgets.BoundedFloatText()<\/a>, &#8230;., etc.<\/li><\/ol>\n\n\n\n<p>You can read about these widgets from the associated link. We will be using the first widget that is widgets.Text()<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">text = widgets.Text(description=\"Text - \")\nout = widgets.Output()\ndef select(change):\n    out.clear_output()\n    with out:\n      display(\"Entered value - \"+change.new)\n  \ntext.observe(select, names=\"value\")\ndisplay(text)\ndisplay(out)<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/text1.png\" alt=\"\" class=\"wp-image-52\" width=\"467\" height=\"287\" srcset=\"https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/text1.png 473w, https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/text1-300x185.png 300w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><figcaption>Text Field<\/figcaption><\/figure><\/div>\n<\/div><\/div>\n\n\n\n<h3><strong><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/examples\/Widget%20List.html#HBox\" target=\"_blank\" rel=\"noreferrer noopener\">HBox and VBox<\/a><\/strong><\/h3>\n\n\n\n<p>HBox and VBox are stacking widgets, these widgets use to arrange different widgets into horizontal space or vertical space. I am using the Text widget to show the example of HBox and VBox.<\/p>\n\n\n\n<div class=\"is-layout-flow wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<div class=\"is-layout-flow wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<div class=\"is-layout-flex wp-container-7 wp-block-columns\">\n<div class=\"is-layout-flow wp-block-column\">\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">text = widgets.Text(description=\"Text - \")\nout = widgets.Output()\ndef select(change):\n    out.clear_output()\n    with out:\n      display(\"Entered value - \"+change.new)\n  \ntext.observe(select, names=\"value\")\n\nhbox = widgets.HBox([text, out])\ndisplay(hbox)<\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"is-layout-flow wp-block-column\">\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">text = widgets.Text(description=\"Text - \")\nout = widgets.Output()\ndef select(change):\n    out.clear_output()\n    with out:\n      display(\"Entered value - \"+change.new)\n  \ntext.observe(select, names=\"value\")\n\nvbox = widgets.VBox([text, out])\ndisplay(vbox)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<figure class=\"is-layout-flex wp-block-gallery-10 wp-block-gallery columns-2 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" loading=\"lazy\" width=\"621\" height=\"294\" src=\"http:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/hbox.png\" alt=\"\" data-id=\"54\" data-full-url=\"http:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/hbox.png\" data-link=\"https:\/\/code-ml.com\/index.php\/2021\/05\/22\/introduction-to-widgets-in-jupyter-notebook-build-your-own-pandas-profiler\/hbox\/\" class=\"wp-image-54\" srcset=\"https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/hbox.png 621w, https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/hbox-300x142.png 300w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><figcaption class=\"blocks-gallery-item__caption\">HBox<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" loading=\"lazy\" width=\"473\" height=\"291\" src=\"http:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/text1.png\" alt=\"\" data-id=\"52\" data-full-url=\"http:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/text1.png\" data-link=\"https:\/\/code-ml.com\/index.php\/2021\/05\/22\/introduction-to-widgets-in-jupyter-notebook-build-your-own-pandas-profiler\/text1\/\" class=\"wp-image-52\" srcset=\"https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/text1.png 473w, https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/text1-300x185.png 300w\" sizes=\"(max-width: 473px) 100vw, 473px\" \/><figcaption class=\"blocks-gallery-item__caption\">VBox<\/figcaption><\/figure><\/li><\/ul><\/figure>\n\n\n\n<h2><strong>Dashboard( Mini Panda&#8217;s profiler)<\/strong><\/h2>\n\n\n\n<p>Finally we are going to build a mini version of panda&#8217;s profiler(dashboard) with four key features:<\/p>\n\n\n\n<ol><li>DataFrame Head<\/li><li>DataFrame Info<\/li><li>Unique values in the chosen column<\/li><li>Graph b\/w two different columns<\/li><\/ol>\n\n\n\n<p>To achieve the given feature into a dashboard, we going learn about one more Important widget.<\/p>\n\n\n\n<p>Tab widget &#8211; Tab widget will create a container for each feature. Tab widget takes a list of widgets to create tabs for each widget. We have shown you earlier in the blog how you can show the DataFrame head and info. We showed you how to chose from the dropdown option and show results accordingly. We can create widgets for all features with the code given below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">#################-- DataFrame Head --#################\noutput_df_head = widgets.Output()\noutput_df_head.clear_output()\nwith output_df_head:\n    print(df.head())\n\n#################-- DataFrame Info --#################\noutput_df_info = widgets.Output()\noutput_df_info.clear_output()\nwith output_df_info:\n    print(df.info())\n\n#########-- Unique values in chosen column --#########\ndropdown_columns = widgets.Dropdown(options = df.columns, description = \"Column - \")\noutput_df_unique = widgets.Output()\n\ndef dropdown_columns_eventhandler(change):\n  output_df_unique.clear_output()\n  ot = df[change.new].unique()\n  with output_df_unique:\n    display(ot)\n\ndropdown_columns.observe(dropdown_columns_eventhandler, names='value')\ndashboard_unique = widgets.VBox([dropdown_columns, output_df_unique])\n\n#########-- Graph b\/w two different columns --########\noutput_df_graph = widgets.Output()\ndropdown_c1 = widgets.Dropdown(options = df.columns, description = \"Column x - \")\ndropdown_c2 = widgets.Dropdown(options = df.columns, description = \"Column y - \")\n\ndef common(x='PassengerId', y = 'Pclass'):\n  output_df_graph.clear_output()\n  gf = df.plot(x=x, y=y, style='o')\n  with output_df_graph:\n    display(gf)\n\ndef dropdown_c1_eventhandler(change):\n    common(change.new, dropdown_c2.value)\ndef dropdown_c2_eventhandler(change):\n    common(dropdown_c1.value, change.new)\n\ndropdown_c1.observe(dropdown_c1_eventhandler, names='value')\ndropdown_c2.observe(dropdown_c2_eventhandler, names='value')\n\ndashboard_graph = widgets.VBox([dropdown_c1, dropdown_c2, output_df_graph])<\/code><\/pre>\n\n\n\n<p>Now we can use each widgets output to display in tab container, as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">tab = widgets.Tab([output_df_head, output_df_info, dashboard_unique, dashboard_graph])\ntab.set_title(0, 'DataFram Head')\ntab.set_title(1, 'DataFram Info')\ntab.set_title(2, 'Unique values in column')\ntab.set_title(3, 'Graph: Column vs column')\ndisplay(tab)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" loading=\"lazy\" width=\"857\" height=\"603\" src=\"http:\/\/code-ml.com\/wp-content\/uploads\/2021\/05\/ezgif.com-gif-maker.gif\" alt=\"\" class=\"wp-image-70\"\/><figcaption>Dashboard in action<\/figcaption><\/figure>\n\n\n\n<h2>Conclusion<\/h2>\n\n\n\n<p>In this blog, we have learned about different widgets that can be used in Jupyter Notebook. These GUI widgets help make notebooks look lively and interactive. We have seen examples of slider, button, text, dropdown, and Tab widgets. And finally, we also created a dashboard a mini version of the panda profiler. You can read about a whole lot of Widgets provided by the <strong>ipywidgets<\/strong> library here &#8211; <a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">Link<\/a><\/p>\n\n\n\n<p>I hope this blog is useful to you and you have learned something new, if you like this blog <strong>share <\/strong>it with your friends. Read more awesome content on my blog website &#8211; <a href=\"http:\/\/code-ml.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/code-ml.com\/<\/a><\/p>\n\n\n\n<h4>References<\/h4>\n\n\n\n<ul><li><a href=\"https:\/\/ipywidgets.readthedocs.io\/en\/stable\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/ipywidgets.readthedocs.io\/en\/stable\/index.html<\/a><\/li><li><a href=\"https:\/\/towardsdatascience.com\/bring-your-jupyter-notebook-to-life-with-interactive-widgets-bc12e03f0916\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/towardsdatascience.com\/bring-your-jupyter-notebook-to-life-with-interactive-widgets-bc12e03f0916<\/a><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jupyter notebooks are an open document format based on JSON. It is one of the most used data science tools among data scientists. In Jupiter notebook, to change the output of the cell or to get desired value out of the cell we need to run it again, this can be tedious and error-prone work. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":104,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[4],"tags":[9,8,5,6,7],"blocksy_meta":{"post_title_panel":"","has_hero_section":"default","39ce7cf8dce944e41d593ab17ae4a335":"","hero_section":"type-1","hero_elements":[{"id":"custom_title","enabled":true,"heading_tag":"h1","title":"Home"},{"id":"custom_description","enabled":true,"description_visibility":{"desktop":true,"tablet":true,"mobile":false}},{"id":"custom_meta","enabled":true,"meta_elements":[{"id":"author","enabled":true,"label":"By","has_author_avatar":"yes","avatar_size":25},{"id":"post_date","enabled":true,"label":"On","date_format_source":"default","date_format":"M j, Y"},{"id":"categories","enabled":true,"label":"In","style":"simple"},{"id":"comments","enabled":true}],"page_meta_elements":{"joined":true,"articles_count":true,"comments":true}},{"id":"breadcrumbs","enabled":false}],"6c32a3f593410bad0f128b90ab4f9b08":"","hero_alignment1":"left","hero_margin":{"desktop":50,"tablet":30,"mobile":30},"hero_alignment2":"center","hero_vertical_alignment":"center","7bc50b10883fc213c2f1793ed3a13709":"","hero_structure":"narrow","3a328f9618106128fef8b038d1e86daf":"","page_title_bg_type":"featured_image","custom_hero_background":{"attachment_id":null},"parallax":{"desktop":false,"tablet":false,"mobile":false},"18fb8ead40c656aa2c8e870eb8490547":"","hero_height":"250px","pageTitleFont":{"family":"Default","variation":"Default","size":{"desktop":"32px","tablet":"30px","mobile":"25px"},"line-height":"CT_CSS_SKIP_RULE","letter-spacing":"CT_CSS_SKIP_RULE","text-transform":"CT_CSS_SKIP_RULE","text-decoration":"CT_CSS_SKIP_RULE"},"pageTitleFontColor":{"default":{"color":"CT_CSS_SKIP_RULEDEFAULT"}},"pageMetaFont":{"family":"Default","variation":"n6","size":"12px","line-height":"1.3","letter-spacing":"CT_CSS_SKIP_RULE","text-transform":"uppercase","text-decoration":"CT_CSS_SKIP_RULE"},"pageMetaFontColor":{"default":{"color":"CT_CSS_SKIP_RULEDEFAULT"},"hover":{"color":"CT_CSS_SKIP_RULEDEFAULT"}},"pageExcerptFont":{"family":"Default","variation":"Default","size":"CT_CSS_SKIP_RULE","line-height":"CT_CSS_SKIP_RULE","letter-spacing":"CT_CSS_SKIP_RULE","text-transform":"CT_CSS_SKIP_RULE","text-decoration":"CT_CSS_SKIP_RULE"},"pageExcerptColor":{"default":{"color":"CT_CSS_SKIP_RULEDEFAULT"}},"breadcrumbsFont":{"family":"Default","variation":"n6","size":"12px","line-height":"CT_CSS_SKIP_RULE","letter-spacing":"CT_CSS_SKIP_RULE","text-transform":"uppercase","text-decoration":"CT_CSS_SKIP_RULE"},"breadcrumbsFontColor":{"default":{"color":"CT_CSS_SKIP_RULEDEFAULT"},"initial":{"color":"CT_CSS_SKIP_RULEDEFAULT"},"hover":{"color":"CT_CSS_SKIP_RULEDEFAULT"}},"pageTitleOverlay":{"default":{"color":"CT_CSS_SKIP_RULE"}},"pageTitleBackground":{"background_type":"color","background_pattern":"type-1","background_image":{"attachment_id":null,"x":0,"y":0},"gradient":"linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)","background_repeat":"no-repeat","background_size":"auto","background_attachment":"scroll","patternColor":{"default":{"color":"#e5e7ea"}},"overlayColor":{"default":{"color":"CT_CSS_SKIP_RULE"}},"backgroundColor":{"default":{"color":"#EDEFF2"}}},"pageTitlePadding":{"top":"50px","bottom":"50px","left":"auto","right":"auto","linked":true},"2dec825d6945bc5968d680373ef15e12":"","page_structure_type":"default","content_style":"inherit","vertical_spacing_source":"inherit","content_area_spacing":"both","background":{"background_type":"color","background_pattern":"type-1","background_image":{"attachment_id":null,"x":0,"y":0},"gradient":"linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)","background_repeat":"no-repeat","background_size":"auto","background_attachment":"scroll","patternColor":{"default":{"color":"#e5e7ea"}},"overlayColor":{"default":{"color":"CT_CSS_SKIP_RULE"}},"backgroundColor":{"default":{"color":"CT_CSS_SKIP_RULE"}}},"content_background":{"background_type":"color","background_pattern":"type-1","background_image":{"attachment_id":null,"x":0,"y":0},"gradient":"linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)","background_repeat":"no-repeat","background_size":"auto","background_attachment":"scroll","patternColor":{"default":{"color":"#e5e7ea"}},"overlayColor":{"default":{"color":"CT_CSS_SKIP_RULE"}},"backgroundColor":{"default":{"color":"#ffffff"}}},"content_boxed_shadow":{"inherit":false,"blur":18,"spread":-6,"v_offset":12,"h_offset":0,"inset":false,"enable":true,"color":{"color":"rgba(34, 56, 101, 0.04)"}},"boxed_content_spacing":{"desktop":{"top":"40px","bottom":"40px","left":"40px","right":"40px","linked":true},"tablet":{"top":"35px","bottom":"35px","left":"35px","right":"35px","linked":true},"mobile":{"top":"20px","bottom":"20px","left":"20px","right":"20px","linked":true}},"content_boxed_radius":{"top":"3px","bottom":"3px","left":"3px","right":"3px","linked":true},"c410d8c92902e41a247079743f8e471f":"","disable_featured_image":"no","disable_post_tags":"no","disable_share_box":"no","disable_author_box":"no","disable_posts_navigation":"no","2ffc009c8f7ee922973841108a44d27f":"","disable_related_posts":"no","disable_header":"no","disable_footer":"no","styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"aioseo_notices":[],"featured_image_urls":{"full":["https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/aleks-dorohovich-nJdwUHmaY8A-unsplash.jpg",640,429,false],"thumbnail":["https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/aleks-dorohovich-nJdwUHmaY8A-unsplash-150x150.jpg",150,150,true],"medium":["https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/aleks-dorohovich-nJdwUHmaY8A-unsplash-300x201.jpg",300,201,true],"medium_large":["https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/aleks-dorohovich-nJdwUHmaY8A-unsplash.jpg",640,429,false],"large":["https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/aleks-dorohovich-nJdwUHmaY8A-unsplash.jpg",640,429,false],"1536x1536":["https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/aleks-dorohovich-nJdwUHmaY8A-unsplash.jpg",640,429,false],"2048x2048":["https:\/\/codeml.ai\/wp-content\/uploads\/2021\/05\/aleks-dorohovich-nJdwUHmaY8A-unsplash.jpg",640,429,false]},"post_excerpt_stackable":"<p>Jupyter notebooks are an open document format based on JSON. It is one of the most used data science tools among data scientists. In Jupiter notebook, to change the output of the cell or to get desired value out of the cell we need to run it again, this can be tedious and error-prone work. To reduce these drawbacks, we can use create interactive widgets, these GUI widgets help make notebooks look lively and interactive. You can show results by using different widgets like buttons, sliders, drop-downs, etc.ipywidgets is the open-source library that helps us to embed those widgets in&hellip;<\/p>\n","category_list":"<a href=\"https:\/\/codeml.ai\/index.php\/category\/useful_tools_for_data_science_and_machine_learning\/\" rel=\"category tag\">Tools<\/a>","author_info":{"name":"Mohammad Ahmad","url":"https:\/\/codeml.ai\/index.php\/author\/md-ahmad0652\/"},"comments_num":"0 comments","_links":{"self":[{"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/posts\/26"}],"collection":[{"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":57,"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"predecessor-version":[{"id":3222,"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/posts\/26\/revisions\/3222"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/media\/104"}],"wp:attachment":[{"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeml.ai\/index.php\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}