module notebookhelper.magic_notebook
¶
Short summary¶
module pyensae.notebookhelper.magic_notebook
Magic command to help within notebooks
Classes¶
class |
truncated documentation |
---|---|
Defines magic commands to help with notebooks |
Functions¶
function |
truncated documentation |
---|---|
register magics function, can be called from a notebook |
Properties¶
property |
truncated documentation |
---|---|
|
return the context or None |
|
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 |
---|---|
defines the way to parse the magic command |
|
defines the way to parse the magic command |
Methods¶
method |
truncated documentation |
---|---|
defines |
|
defines |
Documentation¶
Magic command to help within notebooks
- class pyensae.notebookhelper.magic_notebook.MagicNotebook(**kwargs: Any)¶
Bases:
MagicClassWithHelpers
Defines magic commands to help with notebooks
New in version 1.1.
Create a configurable given a config config.
Parameters¶
- configConfig
If this is empty, default values are used. If config is a
Config
instance, it will be used to configure the instance.- parentConfigurable instance, optional
The parent Configurable instance of this object.
Notes¶
Subclasses of Configurable must call the
__init__()
method ofConfigurable
before doing anything else and usingsuper()
:class MyConfigurable(Configurable): def __init__(self, config=None): super(MyConfigurable, self).__init__(config=config) # Then any other code you need to finish initialization.
This ensures that instances will be configured properly.
- _all_trait_default_generators: Dict[str, Any] = {'config': <bound method TraitType.default of <traitlets.traitlets.Instance object>>, 'parent': <bound method TraitType.default of <traitlets.traitlets.Instance object>>}¶
- _descriptors = [<traitlets.traitlets.ObserveHandler object>, <traitlets.traitlets.Instance object>, <traitlets.traitlets.Instance object>]¶
- _instance_inits = [<bound method ObserveHandler.instance_init of <traitlets.traitlets.ObserveHandler object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>, <bound method Instance.instance_init of <traitlets.traitlets.Instance object>>]¶
- _trait_default_generators = {}¶
- _traits: Dict[str, Any] = {'config': <traitlets.traitlets.Instance object>, 'parent': <traitlets.traitlets.Instance object>}¶
- jsdf(line)¶
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)
- static jsdf_parser()¶
defines the way to parse the magic command
%jsdf
defines
%nb_menu
which displays a menunb_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>)
defines the way to parse the magic command
%nb_menu
- pyensae.notebookhelper.magic_notebook.register_notebook_magics(ip=None)¶
register magics function, can be called from a notebook
- Parameters:
ip – from
get_ipython()