-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculate.py
32 lines (27 loc) · 1.31 KB
/
calculate.py
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
import streamlit as st
class Calculate:
def __init__(self) -> None:
pass;
def get_statistics(self, dataframe):
maximum = dataframe['mag'].max()
most_prone_city = dataframe['city/state'].value_counts().head(1).index[0]
least_prone_city = dataframe['city/state'].value_counts().tail(1).index[0]
most_prone_place = dataframe['place'].value_counts().head(1).index[0]
least_prone_place = dataframe['place'].value_counts().tail(1).index[0]
# print(maximum, most_pront_city, least_prone_city, most_prone_place, least_prone_place)
# print(dataframe['city/state'].value_counts().head(1).values[0])
st.markdown('##### Some cool stats!')
col1, col2, col3 = st.columns(3)
with col1:
st.metric('Maximum on Richter scale:', maximum)
with col2:
st.metric('Most Prone Country: ', most_prone_city)
with col3:
st.metric('Least Prone Country:', least_prone_city)
col4, col5 = st.columns(2)
with col4:
st.metric('Most Prone Place:', most_prone_place)
with col5:
st.metric('Least Prone Place:', least_prone_place)
st.markdown("<p style='text-align: center;'><i>Scroll down for bar charts</i></p>", unsafe_allow_html=True)
st.markdown('---')