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.
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)
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:
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:
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.