API Reference

DataFrame

class cuxfilter.dataframe.DataFrame(data)

A cuxfilter GPU DataFrame object

Attributes
data

Methods

dashboard(self, charts[, layout, theme, …])

Creates a cuxfilter.DashBoard object

from_arrow(dataframe_location)

read an arrow file from disk as cuxfilter.DataFrame

from_dataframe(dataframe)

create a cuxfilter.DataFrame from cudf.DataFrame (zero-copy reference)

dashboard(self, charts: list, layout=<class 'cuxfilter.layouts.layouts.Layout0'>, theme=<class 'cuxfilter.themes.light.Theme'>, title='Dashboard', data_size_widget=True, warnings=False)

Creates a cuxfilter.DashBoard object

Parameters
charts: list

list of cuxfilter.charts

layout: cuxfilter.layouts
title: str

title of the dashboard, default “Dashboard”

data_size_widget: boolean

flag to determine whether to diplay the current datapoints selected in the dashboard, default True

warnings: boolean

flag to disable or enable runtime warnings related to layouts, default False

Returns
cuxfilter.DashBoard object

Examples

>>> import cudf
>>> import cuxfilter
>>> from cuxfilter.charts import bokeh
>>> df = cudf.DataFrame(
>>>     {
>>>         'key': [0, 1, 2, 3, 4],
>>>         'val':[float(i + 10) for i in range(5)]
>>>     }
>>> )
>>> cux_df = cuxfilter.DataFrame.from_dataframe(df)
>>> line_chart_1 = bokeh.line(
>>>     'key', 'val', data_points=5, add_interaction=False
>>> )
>>> # create a dashboard object
>>> d = cux_df.dashboard([line_chart_1])
classmethod from_arrow(dataframe_location)

read an arrow file from disk as cuxfilter.DataFrame

Parameters
dataframe_location: str or arrow in-memory table
Returns
cuxfilter.DataFrame object

Examples

Read dataframe as an arrow file from disk

>>> import cuxfilter
>>> cux_df = cuxfilter.DataFrame.from_arrow(
    './location/of/dataframe.arrow'
    )
classmethod from_dataframe(dataframe)

create a cuxfilter.DataFrame from cudf.DataFrame (zero-copy reference)

Parameters
dataframe_location: cudf.DataFrame
Returns
cuxfilter.DataFrame object

Examples

Read dataframe from a cudf.DataFrame

>>> import cuxfilter
>>> import cudf
>>> cudf_df = cudf.DataFrame(
>>>     {
>>>         'key': [0, 1, 2, 3, 4],
>>>         'val':[float(i + 10) for i in range(5)]
>>>     }
>>> )
>>> cux_df = cuxfilter.DataFrame.from_dataframe(cudf_df)

DashBoard

class cuxfilter.dashboard.DashBoard(charts=[], data=None, layout=<class 'cuxfilter.layouts.layouts.Layout0'>, theme=<class 'cuxfilter.themes.light.Theme'>, title='Dashboard', data_size_widget=True, warnings=False)

A cuxfilter GPU DashBoard object. Examples ——–

Create a dashboard

>>> import cudf
>>> import cuxfilter
>>> from cuxfilter.charts import bokehfrom cuxfilter.charts import bokeh
>>> df = cudf.DataFrame(
>>>     {'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}
>>> )
>>> cux_df = cuxfilter.DataFrame.from_dataframe(df)
>>> line_chart_1 = bokeh.line(
>>>     'key', 'val', data_points=5, add_interaction=False
>>> )
>>> line_chart_2 = bokeh.bar(
>>>     'val', 'key', data_points=5, add_interaction=False
>>> )
>>> d = cux_df.dashboard([line_chart_1, line_chart_2])
>>> d
`cuxfilter DashBoard
[title] Markdown(str)
[chart1] Column(sizing_mode='scale_both', width=1600)
    [0] Bokeh(Figure)
[chart2] Column(sizing_mode='scale_both', width=1600)
    [0] Bokeh(Figure)`
Attributes
charts

Charts in the dashboard as a dictionary.

data_size_widget

Data_size_widget flag.

title

Title of the dashboard.

warnings

Layout warnings flag.

Methods

add_charts(self[, charts])

Adding more charts to the dashboard, after it has been initialized.

app(self[, notebook_url])

Run the dashboard with a bokeh backend server within the notebook.

export(self)

Export the cudf.DataFrame based on the current filtered state of the dashboard.

preview(self)

Preview(Async) all the charts in a jupyter cell, non interactive(no backend server).

show(self[, notebook_url, port, threaded])

Run the dashboard with a bokeh backend server within the notebook.

stop(self)

stop the bokeh server

add_charts(self, charts=[])

Adding more charts to the dashboard, after it has been initialized. Parameters ———- charts: list

list of cuxfilter.charts objects

Notes

After adding the charts, re-run the dashboard.app() or dashboard.show() cell to see the updated charts.

Examples

>>> import cudf
>>> import cuxfilter
>>> from cuxfilter.charts import bokeh
>>> df = cudf.DataFrame(
>>>     {
>>>         'key': [0, 1, 2, 3, 4],
>>>         'val':[float(i + 10) for i in range(5)]
>>>     }
>>> )
>>> cux_df = cuxfilter.DataFrame.from_dataframe(df)
>>> line_chart_1 = bokeh.line(
>>>     'key', 'val', data_points=5, add_interaction=False
>>> )
>>> d = cux_df.dashboard([line_chart_1])
>>> line_chart_2 = bokeh.bar(
>>>     'val', 'key', data_points=5, add_interaction=False
>>> )
>>> d.add_charts([line_chart_2])
app(self, notebook_url='', port: int = 0)

Run the dashboard with a bokeh backend server within the notebook. Parameters ———- url: str, optional

url of the notebook(including the port). Can use localhost instead of ip if running locally

port: int, optional

Port number bokeh uses for it’s two communication protocol. Default is random open port. Recommended to set this value if running jupyter remotely and only few ports are exposed.

Examples

>>> import cudf
>>> import cuxfilter
>>> from cuxfilter.charts import bokeh
>>> df = cudf.DataFrame(
>>>     {
>>>         'key': [0, 1, 2, 3, 4],
>>>         'val':[float(i + 10) for i in range(5)]
>>>     }
>>> )
>>> cux_df = cuxfilter.DataFrame.from_dataframe(df)
>>> line_chart_1 = bokeh.line(
>>>     'key', 'val', data_points=5, add_interaction=False
>>> )
>>> d = cux_df.dashboard([line_chart_1])
>>> d.app(notebook_url='localhost:8888')
property charts

Charts in the dashboard as a dictionary.

property data_size_widget

Data_size_widget flag.

export(self)

Export the cudf.DataFrame based on the current filtered state of the dashboard.

Also prints the query string of the current state of the dashboard. Returns ——- cudf.DataFrame

Examples

>>> import cudf
>>> import cuxfilter
>>> from cuxfilter.charts import bokeh
>>> df = cudf.DataFrame(
>>>     {
>>>         'key': [0, 1, 2, 3, 4],
>>>         'val':[float(i + 10) for i in range(5)]
>>>     }
>>> )
>>> cux_df = cuxfilter.DataFrame.from_dataframe(df)
>>> line_chart_1 = bokeh.line(
>>>     'key', 'val', data_points=5, add_interaction=False
>>> )
>>> line_chart_2 = bokeh.bar(
>>>     'val', 'key', data_points=5, add_interaction=False
>>> )
>>> d = cux_df.dashboard([line_chart_1, line_chart_2])
>>> d.app() #or d.show()
displays dashboard
do some visual querying/ crossfiltering
>>> queried_df = d.export()
final query 2<=key<=4
async preview(self)

Preview(Async) all the charts in a jupyter cell, non interactive(no backend server). Mostly intended to save notebook state for blogs, documentation while still rendering the dashboard.

Notes

Png format

Examples

>>> import cudf
>>> import cuxfilter
>>> from cuxfilter.charts import bokeh
>>> df = cudf.DataFrame(
>>>     {
>>>         'key': [0, 1, 2, 3, 4],
>>>         'val':[float(i + 10) for i in range(5)]
>>>     }
>>> )
>>> cux_df = cuxfilter.DataFrame.from_dataframe(df)
>>> line_chart_1 = bokeh.line(
>>>     'key', 'val', data_points=5, add_interaction=False
>>> )
>>> line_chart_2 = bokeh.bar(
>>>     'val', 'key', data_points=5, add_interaction=False
>>> )
>>> d = cux_df.dashboard([line_chart_1, line_chart_2])
>>> await d.preview()
displays charts in the dashboard
show(self, notebook_url='', port=0, threaded=False, **kwargs)

Run the dashboard with a bokeh backend server within the notebook. Parameters ———- url: str, optional

  • URL where you want to run the dashboard as a web-app,

including the port number. - Can use localhost instead of ip if running locally. - Has to be an open port.

Examples

>>> import cudf
>>> import cuxfilter
>>> from cuxfilter.charts import bokeh
>>> df = cudf.DataFrame(
>>>     {
>>>         'key': [0, 1, 2, 3, 4],
>>>         'val':[float(i + 10) for i in range(5)]
>>>     }
>>> )
>>> cux_df = cuxfilter.DataFrame.from_dataframe(df)
>>> line_chart_1 = bokeh.line(
>>>     'key', 'val', data_points=5, add_interaction=False
>>> )
>>> d = cux_df.dashboard([line_chart_1])
>>> d.show(url='localhost:8889')
stop(self)

stop the bokeh server

property title

Title of the dashboard.

property warnings

Layout warnings flag.