Published
Edited
Jan 3, 2022
Insert cell
Insert cell
kgzip.filenames.filter((a) => a.indexOf("kglab-main/dat") !== -1)
Insert cell
Insert cell
Insert cell
Insert cell
df = py`
from os.path import dirname
import os
import io

buffer = io.StringIO(${await kgzip.file("kglab-main/dat/recipes.csv").text()})
df = ${pd}.read_csv(buffer)
df
`
Insert cell
table(df.to_dict("records").toJs().map(Object.fromEntries))
Insert cell
Insert cell
recipe_row = py`
df = ${df}
recipe_row = df[df["name"] == "anytime crepes"].iloc[0]
recipe_row`
Insert cell
Insert cell
Insert cell
Insert cell
py`ingredients = eval(${recipe_row}["ingredients"])
ingredients`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pd = py`
import pandas as pd#${packagesPy}
pd`
Insert cell
kglab = py`

# make completely sure pyvis got included
import micropip
micropip.install("https://thadk.net/pyodide_packages/pyodide_18_1/pyvis-0.1.9-py2.py3-none-any.whl")

import kglab
# ${otherKglabDependencies} ${kglabDependency} ${micropipDependenciesPy}
kglab
`
Insert cell
py`dir(${kglab})`
Insert cell
py`repr(${kglab})`
Insert cell
Insert cell
import { py, pyodide, downloadPyoFile } from "@thadk/pyodide-18"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more