module notebookhelper.magic_notebook

Inheritance diagram of pyensae.notebookhelper.magic_notebook

Short summary

module pyensae.notebookhelper.magic_notebook

Magic command to help within notebooks

source on GitHub

Classes

class truncated documentation
MagicNotebook Defines magic commands to help with notebooks

Functions

function truncated documentation
register_notebook_magics register magics function, can be called from a notebook

Properties

property truncated documentation
Context return the context or None
cross_validation_lock A contextmanager for running a block with our cross validation lock set to True. At the end of the block, …

Static Methods

staticmethod truncated documentation
jsdf_parser defines the way to parse the magic command %jsdf
nb_menu_parser defines the way to parse the magic command %nb_menu

Methods

method truncated documentation
jsdf defines %jsdf which displays a pandas dataframe into a notebook using qgrid (javascript)
nb_menu defines %nb_menu which displays a menu

Documentation

Magic command to help within notebooks

source on GitHub

class pyensae.notebookhelper.magic_notebook.MagicNotebook(shell=None, **kwargs)[source]

Bases: pyquickhelper.ipythonhelper.magic_class.MagicClassWithHelpers

Defines magic commands to help with notebooks

New in version 1.1.

source on GitHub

_trait_default_generators = {}
jsdf(line)[source]

defines %jsdf which displays a pandas dataframe into a notebook using qgrid (javascript)

jsdf

The magic command %jsdf displays a dataframe using qgrid module. The code is the following:

import qgrid
if firt_call:
    qgrid.set_defaults(precision=<precision>)
    self.first_jsdf_call = False

df = args.df
grid_options = dict(defaultColumnWidth=<defaultColumnWidth>,
                    enableColumnReorder=<enableColumnReorder>,
                    multiColumnSort=<multiColumnSort>,
                    rowHeight=<rowHeight>,
                    showHeaderRow=<showHeaderRow>,
                    forceFitColumns=<forceFitColumns>,
                    autoHeight=<autoHeight>,
                    enableCellNavigation=<enableCellNavigation>)
qgrid.show_grid(df, grid_options=grid_options)

source on GitHub

static jsdf_parser()[source]

defines the way to parse the magic command %jsdf

source on GitHub

nb_menu(line)[source]

defines %nb_menu which displays a menu

nb_menu

The magic command %nb_menu displays a menu in a notebook. It parses a notebook and displays a menu gathering all sections within that notebook. The code is the following:

from pyquickhelper.ipythonhelper import add_notebook_menu
js = add_notebook_menu(menu_id=<menu_id>, header=<title>, format=<format>,
                    first_level=<level1>, last_level=<level2>,
                    raw=<raw>)

source on GitHub

static nb_menu_parser()[source]

defines the way to parse the magic command %nb_menu

source on GitHub

pyensae.notebookhelper.magic_notebook.register_notebook_magics(ip=None)[source]

register magics function, can be called from a notebook

Parameters:ip – from get_ipython()

source on GitHub