nbforms package

Module contents

nbforms: A Python library for interactive multi-user Jupyter notebook forms

class nbforms.Form(config_path: str = 'nbforms_config.json')

Bases: object

A class for interacting with the nbforms server.

The Form class sends requests to the nbforms server that records users’ resposnes. It provides authentication so that users can be differentiated on the server, stores users’ responses from widgets, generates and displays the necessary widgets, and pulls data from the server for analysis.

Parameters:

config_path (str) – the path to an nbforms config file

ask(*identifiers: str)

Ask configured questions by dispalying widgets.

Parameters:

identifiers (str) – question identifiers to be asked in the widget; if none are specified, defaults to all questions

take_attendance()

Log attendance on the server instance.

Raises:

ValueError – if this notebook is not configured to take attendance

to_df(*identifiers, user_hashes=False)

Get data from the server and return a pandas DataFrame.

Parameters:
  • identifiers (str) – which questions to include in the table; if none are specified, defaults to all questions

  • user_hashes (bool) – whether to include hashes of usernames

Returns:

a dataframe containing the data from the server

Return type:

pandas.DataFrame

Raises:

ValueError – if any of the question identifiers are not present in the config

to_table(*identifiers: str, user_hashes: bool = False)

Get data from the server and return a datascience Table.

Parameters:
  • identifiers (str) – which questions to include in the table; if none are specified, defaults to all questions

  • user_hashes (bool) – whether to include hashes of usernames

Returns:

a table containing the data from the server

Return type:

datascience.Table