summarynb package

Submodules

summarynb.cli module

Console script for summarynb.

summarynb.cli.get_or_create_metadata()[source]
summarynb.cli.git_root_path()[source]
summarynb.cli.path_to_config_file()[source]
summarynb.cli.path_to_hook()[source]
summarynb.cli.prune_nb()[source]
summarynb.cli.write_metadata(df)[source]

Module contents

summarynb.chunks(entries, shape)[source]

Reshape [entries] into chunks of shape [shape], which can be: - a (number of rows, number of columns) tuple, in which case we verify length - or simply a number of columns, in which case we guess the right number of rows, and allow in-complete rows.

summarynb.csv(fname, cols=None, **kwargs)[source]

Read a csv from [fname]. Optionally subset to columns [cols]. Kwargs passed onto pandas read_csv.

summarynb.empty(width=None)[source]

Creates empty separator block.

Parameters

width (int, optional) – specify block width, defaults to None

summarynb.image(img_src)[source]

Renders an image.

Parameters

img_src (str) – Image filename.

Returns

Template function that accepts a max pixel width integer and returns HTML.

Return type

function

summarynb.indexed_csv(fname, cols=None, **kwargs)[source]

Read a csv from [fname], and set first column as index column. Optionally subset to columns [cols]. Kwargs passed onto pandas read_csv. Useful for reading in pandas series quickly.

summarynb.plaintext(text, **kwargs)[source]

Renders plain text.

Parameters

text (str) – text to display

summarynb.show(entries, headers=None, max_width=800, max_height=800)[source]

Display chosen figures and tables in an HTML table.

Parameters:
  • [entries]: List of rows. Each row is a list of columns. Each column is a list of executable functions that return an HTML template.

For convenience:
  • Raw filenames (not wrapped in executable functions that return HTML templates) are also accepted, and will be auto-wrapped based on file extension.

  • If a list of lists is not provided, the input is interpreted as forming columns in a single row.

  • [headers]: List of column headers.

  • [max_width]: set max pixel width for images, default 800px. set to None to disable max width.

  • [max_height]: set max pixel height for images, default 800px. set to None to disable max height.

summarynb.table(df)[source]

Renders a Pandas dataframe.

Parameters

df (pandas.DataFrame) – the dataframe

Returns

Template function that returns HTML.

Return type

function

summarynb.textfile(fname, **kwargs)[source]

Read a text file and render as plain text.