|
import streamlit as st |
|
import pandas as pd |
|
import numpy as np |
|
|
|
|
|
|
|
with st.sidebar: |
|
st.image("https://www.onepointltd.com/wp-content/uploads/2020/03/inno2.png") |
|
st.title("Samuel's Portfolio") |
|
choice = st.radio("Navigation", ["About Sam","Uber Project","Attached files", "Contact"]) |
|
st.info("This project application helps you understand more about Samuel and his capabilities in detail.") |
|
|
|
if choice == "About Sam": |
|
st.title("Hi am sam") |
|
|
|
if choice == "Uber Project": |
|
st.title('Uber pickups in NYC') |
|
|
|
DATE_COLUMN = 'date/time' |
|
DATA_URL = ('https://s3-us-west-2.amazonaws.com/' |
|
'streamlit-demo-data/uber-raw-data-sep14.csv.gz') |
|
|
|
@st.cache_data |
|
def load_data(nrows): |
|
data = pd.read_csv(DATA_URL, nrows=nrows) |
|
lowercase = lambda x: str(x).lower() |
|
data.rename(lowercase, axis='columns', inplace=True) |
|
data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN]) |
|
return data |
|
|
|
|
|
data_load_state = st.text('Loading data...') |
|
|
|
data = load_data(10000) |
|
|
|
data_load_state.text('Loading data...done!') |
|
data_load_state.text("Done! (using st.cache_data)") |
|
|
|
if st.checkbox('Show raw data'): |
|
st.subheader('Raw data') |
|
st.write(data) |
|
|
|
st.subheader('Number of pickups by hour') |
|
|
|
hist_values = np.histogram( |
|
data[DATE_COLUMN].dt.hour, bins=24, range=(0,24))[0] |
|
st.bar_chart(hist_values) |
|
|
|
|
|
hour_to_filter = st.slider('hour', 0, 23, 17) |
|
filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter] |
|
st.subheader(f'Map of all pickups at {hour_to_filter}:00') |
|
st.map(filtered_data) |
|
|
|
if choice == "Contact": |
|
st.title("You can contact me via:") |
|
|
|
if choice == "Attached files": |
|
st.title("Download final project report here") |