Skip to content

Commit

Permalink
Tidy package install example
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Mar 1, 2024
1 parent a5da36d commit a07cb6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ globalThis.qpyodideInstance = await import(

// Load the `micropip` package to allow installation of packages.
await mainPyodide.loadPackage("micropip");
await mainPyodide.runPythonAsync(`
import micropip
`);

// Load the `matplotlib` package with necessary environment hook
await mainPyodide.loadPackage("matplotlib");
Expand Down
6 changes: 4 additions & 2 deletions docs/qpyodide-code-cell-demo.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,17 @@ await micropip.install("seaborn")
Then, we have:

```{pyodide-python}
# External Python package
import seaborn as sns
# Core Pyodide packages
import numpy as np
import pandas as pd
data = np.random.multivariate_normal([0, 0], [[5, 2], [2, 2]], size=2000)
data = pd.DataFrame(data, columns=['x', 'y'])
sns.distplot(data['x'])
sns.distplot(data['y']);
sns.displot(data['x']);
```

## Graphing
Expand Down

0 comments on commit a07cb6a

Please sign in to comment.