API Reference#
- class Symphony(table, id_column='id', files_path=None, data_type=None, instances_per_page=None, notebook=False)[source]#
A framework for modular, interactive data science visualizations. Symphony provides a collection of widgets users can use to explore their data both in Jupyter Notebooks and standalone web dashboards.
- Parameters:
table (pa.Table or pd.DataFrame or str) – A Pandas DataFrame, Apache Arrow table, or a link to a
.arrow
file with metadata columns (a.arrow
file can be obtained using theto_arrow_file
function).id_column (str, optional) – Name of the identifier column, by default
id
.files_path (str, optional) – A file path or URL for fetching non-tabular data instances. The path must be relative to the root directory of the Jupyter Notebook or Lab.
data_type (str, optional) – The type of the data passed to Symphony. Currently supports
image
andaudio
. If None, Symphony will try to infer the type from the id column extension.instances_per_page (str, optional) – How many instances each page in a widget should show. If
None
, Symphony will select a sensible default given the selected data type.notebook (bool, optional) – If true, the data path is updated to use the Jupyter Notebook fileserver, by default
True
.
- widget(widget, **kwargs)[source]#
Render a SymphonyWidget.
- Parameters:
widget (Type[SymphonyWidget]) – The widget to be added to symphony.
- Returns:
Notebook container for toolbar and created widget.
- Return type:
HBox
- export(export_path, name=None, files_path=None, symlink_files=False)[source]#
Export the current widgets to a static page. Creates a directory with an
index.html
file, data folder, and JavaScript files for each widget.- Parameters:
export_path (str or Path) – The folder to export the static page to.
name (str, optional) – Name of the exported app. By default
None
, using the export path.files_path (str or Path, optional) – The location to fetch files from if different from the original path. By default
None
, using the original path.symlink_files (bool, optional) – Whether to create a symlink to local data, by default
False
.
- standalone(widgets, export_path, widget_params=[], name=None, files_path=None, symlink_files=False)[source]#
Create a standalone app with the given widgets. Similar to the
export()
function but does not require the widgets to have been passed to Symphony beforehand.- Parameters:
widgets (List[Type[SymphonyWidget]]) – List of SymphonyWidgets to include in the standalone app.
export_path (str or Path) – Where to export the standalone app to.
widget_params (List[Dict]) – List of named parameters to pass to each widget. Must be the same length as widgets, and be an empty dict
{}
for no options. By default an empty list.name (str, optional) – Name of this exported app. By default
None
, using the export path.files_path (str or Path, optional) – The location to fetch files from if different from the original path. By default
None
, using the original path.symlink_files (bool, optional) – Whether to create a symlink to local data, by default
False
.
- get_symphony_spec()[source]#
Get the Symphony spec for the current Symphony report
- Returns:
The spec for the current Symphony report.
- Return type:
SymphonySpec
- get_layout()[source]#
Get the current static app layout.
- Returns:
Set of pages with their corresponding layout settings.
- Return type:
List
- get_selected()[source]#
Get the selected instances for Symphony.
- Returns:
List of selected instances to update Symphony with.
- Return type:
List
- get_filter()[source]#
Get the filter string for Symphony.
- Returns:
The filter that will be applied to the table.
- Return type:
- get_table()[source]#
Get the table based on which Symphony creates visualizations.
- Returns:
The table on which visualizations should be based.
- Return type:
pa.Table
- set_layout(layout)[source]#
Set the current static app layout.
- Parameters:
layout (List) – List of pages describing each widget’s layout settings.
- set_selected(selected)[source]#
Set the selected instances for Symphony.
- Parameters:
selected (List) – List of selected instances to update Symphony with.
- set_filter(filter)[source]#
Set the filter string for Symphony.
- Parameters:
filter (str) – The filter that will be applied to the table.