Skip to content

Quickstart

These instructions will help you create a report in <1 minute. We will build a simple HTML report using Python based on the Iris dataset.

Installation

First, install Arakawa using pip or conda. Check out our installation page for installation options.

pip3 install -U arakawa

Setting Things Up

import altair as alt
import arakawa as ar
from vega_datasets import data

We've imported arakawa, the popular visualization library altair, and vega_datasets which contains some sample datasets.

Let's load the Iris dataset and get a list of the features.

df = data.iris()
columns = list(df.columns)
print(columns)
['sepalLength', 'sepalWidth', 'petalLength', 'petalWidth', 'species']

Blocks

Your report is comprised of Blocks, which are Python objects that wrap around common objects such as datasets, plots, and other blocks. There are display blocks, such as Plot or DataTable, and layout blocks, such as Select and Group.

Having loaded our DataFrame above and with knowledge of our column names, we first create a simple scatterplot using the Altair plotting library.

We then build a simple set of blocks which presents two tabs: one with our plot, and one with our DataFrame.

fig = (
    alt.Chart(df)
    .mark_point()
    .encode(x=alt.X("sepalLength", scale=alt.Scale(zero=False)),
            y=alt.X("sepalWidth", scale=alt.Scale(zero=False)),
            color="species")
)

view = ar.Select(ar.Plot(fig, label="Plot"), ar.DataTable(df, label="Data"))
view

Reports

Once we have a view, we can save it as an HTML report to share.

Let's save it as a report and open it in a new window.

ar.save_report(view, "quickstart_report.html", open=True)
# or
ar.Report(view).save("quickstart_report.html", open=True)

App saved to ./quickstart_report.html

App saved to ./quickstart_report.html

Sharing Your Report

That's it! As Arakawa has created an HTML file, you can now share this Slack or email without deploying any code or configuring a backend server.