How to save a Jupyter notebook in html and upload it into a managed folder ?
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 folder
folder = dataiku.Folder("Monitoring report")
# Get notebook
client = 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
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023, Circle Member Posts: 2,590 NeuronWhat are you trying to achieve?
-
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 dataiku from dataiku import pandasutils as pdu import pandas as pd import numpy as np import matplotlib.pyplot as plt from IPython.display import display, Markdown, HTML # Get dataframe data_in = dataiku.Dataset("data_in") df = data_in.get_dataframe() # Display display(df.style \ .format( "{:.2%}", ) .set_table_styles( [{ 'selector': '.row_heading', 'props': [('text-align', 'center')] }, ) ) # Save the notebook and upload in folder -
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023, Circle Member Posts: 2,590 NeuronI 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.
-
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 Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023, Circle Member Posts: 2,590 NeuronAgain that’s a step not a goal. What are you really trying to achieve? Why do you want them saved like that?