File size: 1,615 Bytes
2019658
 
 
 
 
 
 
 
 
 
425ebac
2019658
 
 
425ebac
 
 
2019658
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c69dcae
2019658
 
c69dcae
2019658
 
 
 
 
 
 
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
40
41
42
43
44
45
import plotly.express as px
import streamlit as st
import pandas as pd

df = px.data.gapminder()

st.write(df)

year_options = df['year'].unique().tolist()
year = st.selectbox("Which year would you like to see?", year_options, 0)
#df = df[df['year'] == year]

fig = px.scatter(df, x="gdpPercap", y="lifeExp",
                 size="pop", color="continent", hover_name="continent",
                 log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90],
                 animation_frame="year", animation_group="country")
                

fig.update_layout(width=800)

st.write(fig)

covid = pd.read_csv('https://raw.githubusercontent.com/shinokada/covid-19-stats/master/data/daily-new-confirmed-cases-of-covid-19-tests-per-case.csv')
covid.columns = ['Country', 'Code', 'Date', 'Confirmed', 'Days since confirmed']
covid['Date'] = pd.to_datetime(covid['Date']).dt.strftime('%Y-%m-%d')
country_options = covid['Country'].unique().tolist()

st.write(covid)

date_options = covid['Date'].unique().tolist()
date = st.selectbox("Which date would you like to see?", date_options, 100)
country = st.multiselect("Which country would you like to see?", country_options, ['Brazil'])
covid = covid[covid['Country'].isin(country)]
# covid = covid[covid['Date'] == date]

fig2 = px.bar(covid, x="Country", y="Confirmed", color="Country",
              range_y=[0,35000], animation_frame="Date", animation_group="Country")

fig2.layout.updatemenus[0].buttons[0].args[1]['frame']['duration'] = 30
fig2.layout.updatemenus[0].buttons[0].args[1]['transition']['duration'] = 5

fig2.update_layout(width=800)

st.write(fig2)