Skip to content

Add %%python cell magic command #6

Open
@robertbindar

Description

@robertbindar

The use case I currently see for this magic command is to allow users to customize as much as possible the charts they can generate based on the last query result in a notebook. They can do this by either using some advanced features of the matplotlib library that we'll probably never be able to provide or by using a totally different charting library like Altair.

Initially this magic command should allow users to execute arbitrary python code in a notebook cell and the result of the last executed query should be present in the python context of this particular %%python cell.

Such a cell might look something like:

%%python
import altair as alt

# generate heatmap based on last query data
# last_select is a pandas DataFrame that kernel makes available for this cell
alt.Chart(last_select).mark_rect().encode(
    x='x:O',
    y='y:O',
    color='z:Q'
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions