pythonjupyter-notebookdata-science-experience

using TQDM in Watson Studio Notebooks


I'm using Pandas, and I would like to use the TQDM progress bar in the notebook.

After loading TQDM:

from tqdm.auto import tqdm
tqdm.pandas()

and applying a function to the Pandas Dataframe:

new_df = df.progress_apply(...)

I get as output, instead of the progress bar:

HBox(children=(FloatProgress(value=0.0, max=21375.0), HTML(value='')))

I already seen this SO answer, but I'm not sure how to do it within a Watson notebook.


Solution

  • Watson studio environments do not have "widgetsnbextension" notebook extension by default enabled.

    In order to enable it, create a custom environment and enable "Esri ArcGIS" extension which will enables widgetsnbextension for ipywidgets when you start a notebook with this custom environment defintion.

    enter image description here

    https://dataplatform.cloud.ibm.com/docs/content/wsj/getting-started/faq.html#can-i-add-arbitrary-notebook-extensions

    Once enabled, create new notebook with this custom environment definition.

    enter image description here

    Reference on how to create custom environment https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/customize-envs.html