b
b
bamboolib
Search
⌃K

Live Code Export

What the live code export does and how to use it
Whenever you create a transformation, you can get a live code export of that transformation in the cell from where you have called bamboolib. This page shows you what the live code export does and how you can use it for your workflow.
For this tutorial, we are using the titanic data set that comes pre-installed with bamboolib. If you are not set up yet, check the Getting Started guide.

How the Live code export works

Copy & paste the following code in a Jupyter cell and run the code:
import pandas as pd
import bamboolib as bam
df = pd.read_csv(bam.titanic_csv)
df
Now, open bamboolib and change the datatype of Survived into boolean by clicking on the icon next to the Survived column header. Afterwards, make sure that the "Live Code Export" checkbox is checked.
You should see that bamboolib has added some code to your Jupyter cell and that Survived contains boolean values now:
Whenever you keep "Live Code Export" checked, bamboolib will automatically extend the Jupyter cell with a code snippet after you execute a transformation.
Now, let's drop all missing values in Age and rename the result to "df_cleaned". Use can use the "Drop missing (NA) values" transformation to do that.
You should see the following:
After that, create a new Jupyter cell and simply type the following:
df_cleaned
After running the cell, you should see the titanic dataframe without missing values in the Age column.
As you can see, whenever bamboolib creates a new variable in the code export (such as "df_selection" in the example), that variables is directly accessible in your Jupyter Notebook. In our example, we created a new dataframe "df_cleaned" as the result of dropping missing values in Age. After executing the transformation, "df_cleaned" was accessible within the notebook.
If bamboolib changes the name of your dataframe and Live Code Export is active, then that variable is directly accessible in the Notebook.
Want to learn more about the live code export? Please send us an email with your questions. We are happy to help you and add more material here.