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.
If you haven’t already, follow the Install the Beneath SDK quick start to install and authenticate Beneath on your local computer.
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")
From the command line, we create a project named financial-reference-data
:
beneath project create USERNAME/financial-reference-data
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(
table_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/table:s-and-p-500-constituents
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