Skip to content

Instantly share code, notes, and snippets.

@jochasinga
Last active July 20, 2022 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jochasinga/f95a2971d0d6728cd789d5a28c3daa59 to your computer and use it in GitHub Desktop.
Save jochasinga/f95a2971d0d6728cd789d5a28c3daa59 to your computer and use it in GitHub Desktop.
Uploading the Iris dataset to web3storage API and back as Panda dataframe
import pandas as pd
import requests
base_url = "https://api.web3.storage"
headers = {"Authorization": "Bearer <YOUR_API_TOKEN>"}
response = requests.post(base_url + '/upload', headers=headers, data=open('./iris.csv', 'rb'))
pprint(response.json())
cid = response.json()["cid"]
# read the data into dataframe
df = pd.read_csv(f"https://dweb.link/ipfs/{cid}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment