21 lines
620 B
Python
21 lines
620 B
Python
from nicegui import ui
|
|
import pandas as pd
|
|
from ex4nicegui import bi
|
|
from pyecharts.charts import Bar
|
|
|
|
df = pd.read_csv("gapminder.csv")
|
|
print(df.columns)
|
|
# ['Unnamed: 0', 'country', 'continent', 'year', 'lifeExp', 'pop',
|
|
# 'gdpPercap', 'iso_alpha', 'iso_num']
|
|
ds = bi.data_source(df)
|
|
|
|
# select_year = df.ui_select("year")
|
|
select_continent =ds.ui_select("continent")
|
|
ds.ui_select("country")
|
|
|
|
@df.ui_echarts
|
|
def bar(data: pd.DataFrame):
|
|
data = data.groupby(["year"])["gdpPercap"].sum().reset_index()
|
|
return Bar().add_xaxis(data["year"].tolist()).add_yaxis("gdpPercap",data["gdpPercap"].tolist())
|
|
|
|
ui.run() |