Publish a Pandas DataFrame

A guide to loading a Pandas DataFrame into Beneath and sharing it with others

This quick start will show you how to publish a Pandas DataFrame on Beneath. Share the DataFrame with others, or use it as reference data in a Beneath data pipeline or SQL query.

Install the Beneath SDK

If you haven’t already, follow the Install the Beneath SDK quick start to install and authenticate Beneath on your local computer.

Create a Pandas DataFrame

In this example, we’ll share a csv file of S&P 500 stocks that we’ve saved locally. Here we create a DataFrame from the csv:

import pandas as pd
df = pd.read_csv("data/s-and-p-500-constituents.csv")

Create a Beneath project

From the command line, we create a project named financial-reference-data:

beneath project create USERNAME/financial-reference-data

Load the DataFrame into Beneath

Use the Beneath Python SDK to write the data into Beneath. We can optionally provide a key to index the data and a little description:

import beneath
await beneath.write_full(
    stream_path="USERNAME/financial-reference-data/s-and-p-500-constituents",
    records=df,
    key=["symbol"],
    description="The full list of companies in the S&P 500 (updated March 31st, 2021)"
)

After loading the data, go take a look at the data in the web console: https://beneath.dev/examples/financial-reference-data/stream:s-and-p-500-constituents

Give your teammates access

Share the project with your friends:

beneath project update-permissions USERNAME/PROJECT_NAME FRIEND_USERNAME --view --create

Or make your project completely public:

beneath project update USERNAME/PROJECT_NAME --public