Loading data
Loading data files from local and external sources.
Data
Pyodide lives in an isolated virtual file system within the browser and cannot access your local system.
There are two ways To access data
- loaded as a resource and copied to the web server so that it can be served with the live html web page (self-contained)
- pulled from an external server (external data)
Self-contained
Add the data file to the resources block of the yaml and it will be loaded with the web page.
pyodide:
resources:
- mydata.csv
External data
Here’s an example file, stored on github as a csv file.
pyodide:
resources:
- https://raw.githubusercontent.com/mwaskom/seaborn-data/master/flights.csv
Downloading LFS files from github is more complicated. Downloading the file just gives you a json file that points (essentially) to another json. Then you construct yaj to make an api call for the file:
https://gist.github.com/fkraeutli/66fa741d9a8c2a6a238a01d17ed0edc5
Use pandas as seaborn to view the data file.
the file is zipped, so we need to unzip it.