How to save a Jupyter notebook in html and upload it into a managed folder ?

Options
cclee93
cclee93 Registered Posts: 4

Hello everyone,

I am using Jupyter notebook to edit a Python recipe.

Its output should be a folder that contains the Jupyter notebook in html format.

# Output folderfolder = dataiku.Folder("Monitoring report")# Get notebookclient = dataiku.api_client()project_key = dataiku.default_project_key()project = client.get_project(project_key)nb = project.get_jupyter_notebook("notebook editor for python_recipe")# Save notebook in html and upload to folder??

Do you have an idea to do that kind of treatment ?

Thank you in advance for your help

Tagged:

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,710 Neuron
    Options

    What are you trying to achieve?

  • cclee93
    cclee93 Registered Posts: 4
    Options

    Let's say I have a python recipe where I display some pandas dataframe (with some styles). I wish exporting it in a notebook and then save in a folder.

    import dataikufrom dataiku import pandasutils as pduimport pandas as pdimport numpy as npimport matplotlib.pyplot as pltfrom IPython.display import display, Markdown, HTML# Get dataframedata_in = dataiku.Dataset("data_in")df = data_in.get_dataframe()# Displaydisplay(df.style \.format("{:.2%}",).set_table_styles([{'selector': '.row_heading','props': [('text-align', 'center')]},))# Save the notebook and upload in folder

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,710 Neuron
    Options

    I understand that you are trying to save the notebook to a folder but why do you want to do that? What’s your goal? The notebook it’s already saved in the DATA_DIR so there might be better ways of achieving your actual requirement.

  • cclee93
    cclee93 Registered Posts: 4
    Options

    Thank you for your answer.

    My goal is to save the notebook in different subfolders, based on the year on which it is launched.

    For example:

    Notebook_2023.html

    Notebook_2024.html

    etc.

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,710 Neuron
    Options

    Again that’s a step not a goal. What are you really trying to achieve? Why do you want them saved like that?

Setup Info
    Tags
      Help me…