Python cell operator supports Python in a manner analogous to a typical Python notebook cell, along with additional functionality to support integration with the rest of the Einblick environment.
You can import Python notebooks directly into Einblick canvases using the
Import notebook functionality on the app home.
Python cell operator in a canvas shares a common runtime specific to the canvas, so any variables defined in one cell will be available in any other inside the canvas.
You can also pass variables from Python cells (typically Pandas dataframes) to other cells, like Table or even SQL.
Because Einblick allows you to maintain parallel Python cell flows, you may want to use the
Run Flow dropdown option instead of the typical
Run button. This will execute all upstream cells, and ensure that all variables are created and in the state you would expect.
Packages can be installed by using the IPython magic command
!pip install <package-name>.
Packages can be imported using the
import <package-name command, just like you would in a notebook. Packages must be downloaded first, though we have a few common packages preloaded (e.g. pandas).
Interacting with Dataframes
Reading Datasets Programatically
There are two ways to use a dataframe in the canvas as a
pandas dataframe in the shared runtime.
The first is to add a dataframe to the dataframe input of the cell operator. The dataframe will then be available for use through the
The second way is to call
einblick.read_df(df) with the appropriate dataframe name from the Dataframes menu.
You should not use
Exposing Runtime Dataframes as Cell Output Dataframes
Python cell has an
Output menu on the left that allows you to choose the name of the variable in the runtime exposed as an output dataframe. For example, in the following image, the cell exposes
filtered_df as its output dataframe, instead of the default
Many Python packages support the display of visual outputs, and many such libraries are supported in
Python cells. Examples of supported packages include
No special syntax is required to display outputs beyond what is typical for each package. For example, this example in the
matplotlib example gallery works out-of-the-box.