Loading data

Author
Affiliation

Aaron Nielsen

White Noise Technology, LLC

Published

March 12, 2025

Abstract

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

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.

References

Gnadt, Albert R., Joseph Belarge, Aaron Canciani, Lauren Conger, Joseph Curro, Alan Edelman, Peter Morales, et al. 2023. DAF-MIT AIA Open Flight Data for Magnetic Navigation Research.” Zenodo. https://doi.org/10.5281/zenodo.4271803.

Pyodide interactive python web pages with Quarto by Aaron Nielsen is licensed under CC BY-NC-SA 4.0