-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (24 loc) · 1.02 KB
/
app.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
import pandas as pd
import numpy as np
DATA_URL = (
"C:/Users/w1n5t/Desktop/coding/stkorea/motor_collision_korea.csv"
)
st.title("Motor Vehicle Collisions in Korea")
st.markdown("This streamlit application is using for "
"monitoring motor vehicle Collisions in Korea domestically")
@st.cache(persist=True)
def load_data(nrows):
data = pd.read_csv(DATA_URL, nrows = nrows,encoding='CP949')
data.dropna(subset=['LATITUDE', 'LONGITUDE'], inplace = True)
lowercase = lambda x: str(x).lower()
data.rename(lowercase, axis= 'columns', inplace= True)
data.rename(columns = {'crash_year' : 'year'})
return data
data = load_data(10000)
st.header("where are the most people injured in korea?")
injured_people = st.slider("Number of persons who injured by Motor collision", 0, 23)
st.map(data.query("injured_persons > @injured_people")[["latitude", "longitude"]].dropna(how = "any"))
if st.checkbox("Show Raw Data", False):
st.subheader('Raw Data')
st.write(data)