-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyScript_Exemplo.py
More file actions
40 lines (30 loc) · 874 Bytes
/
PyScript_Exemplo.py
File metadata and controls
40 lines (30 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<py-env>
- pandas
- matplotlib
</py-env>
</head>
<body>
<h1>Importando biblioteca usando pyenv</h1>
<div id="tabela_paises"></div>
<div id="grafico_qtde"></div>
<py-script>
import pandas as pd
import matplotlib.pyplot as plt
from pyodide.http import open_url
link = open_url("https://raw.githubusercontent.com/cs109/2014_data/master/countries.csv")
tabela = pd.read_csv(link)
pyscript.write("tabela_paises",tabela)
contagem = tabela["Region"].value_counts()
fig, eixo = plt.subplots()
contagem.plot(ax=eixo)
pyscript.write("grafico_qtde", fig)
</py-script>
</body>
</html>