Time required: 5 minutes.
In this quick-start, we read a data stream from Beneath into a Jupyter notebook. Jupyter notebooks provide an interactive environment in Python (as well as many other languages) that many data analysts like to use to work with data.
Install the latest version of the Python SDK from your command line:
pip3 install --upgrade beneath
Go to the Console, and log in. If you don’t yet have an account, create one.
From your command line:
beneath auth SECRET
Now your secret has been stored in a hidden folder,
.beneath, in your home directory. When you use Beneath from your local machine, it will automatically authenticate with this secret.
You can read any public data stream (for example, check out the featured projects) or any of the private data streams that you have access to.
The Beneath directory structure is USER/PROJECT/STREAM.
In the Console, navigate to your desired stream, and click on the API tab
If you don’t have Jupyter installed, here’s a super quick installation guide to get up-and-running.
From your command line, it’s simple to launch a notebook:
In the notebook, you can run code interactively. Enter your code in a cell and run it with
enter. Now you’re ready to load some data from Beneath.
A few short lines of Python are all you need to import Beneath data into your notebook environment. On the “API” tab of every stream on Beneath, you’ll find a Python snippet you can copy and paste to load records into your code.
from beneath import Client client = Client() df = await client.easy_read("bem/covid19/cases", to_dataframe=True)
And there’s your data, all ready for analysis!