Last active
July 20, 2022 18:56
-
-
Save jochasinga/f95a2971d0d6728cd789d5a28c3daa59 to your computer and use it in GitHub Desktop.
Uploading the Iris dataset to web3storage API and back as Panda dataframe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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