supernovamutinda commited on
Commit
b5316f9
1 Parent(s): 5ad4e4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -3
app.py CHANGED
@@ -7,14 +7,50 @@ import numpy as np
7
  with st.sidebar:
8
  st.image("https://www.onepointltd.com/wp-content/uploads/2020/03/inno2.png")
9
  st.title("Samuel's Portfolio")
10
- choice = st.radio("Navigation", ["About Sam","Projects","Attached files", "Contact"])
11
  st.info("This project application helps you understand more about Samuel and his capabilities in detail.")
12
 
13
  if choice == "About Sam":
14
  st.title("Hi am sam")
15
 
16
- if choice == "Projects":
17
- st.title("Projects done by Samuel")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  if choice == "Contact":
20
  st.title("You can contact me via:")
 
7
  with st.sidebar:
8
  st.image("https://www.onepointltd.com/wp-content/uploads/2020/03/inno2.png")
9
  st.title("Samuel's Portfolio")
10
+ choice = st.radio("Navigation", ["About Sam","Uber Project","Attached files", "Contact"])
11
  st.info("This project application helps you understand more about Samuel and his capabilities in detail.")
12
 
13
  if choice == "About Sam":
14
  st.title("Hi am sam")
15
 
16
+ if choice == "Uber Project":
17
+ st.title('Uber pickups in NYC')
18
+
19
+ DATE_COLUMN = 'date/time'
20
+ DATA_URL = ('https://s3-us-west-2.amazonaws.com/'
21
+ 'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
22
+
23
+ @st.cache_data
24
+ def load_data(nrows):
25
+ data = pd.read_csv(DATA_URL, nrows=nrows)
26
+ lowercase = lambda x: str(x).lower()
27
+ data.rename(lowercase, axis='columns', inplace=True)
28
+ data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN])
29
+ return data
30
+
31
+ # Create a text element and let the reader know the data is loading.
32
+ data_load_state = st.text('Loading data...')
33
+ # Load 10,000 rows of data into the dataframe.
34
+ data = load_data(10000)
35
+ # Notify the reader that the data was successfully loaded.
36
+ data_load_state.text('Loading data...done!')
37
+ data_load_state.text("Done! (using st.cache_data)")
38
+
39
+ if st.checkbox('Show raw data'):
40
+ st.subheader('Raw data')
41
+ st.write(data)
42
+
43
+ st.subheader('Number of pickups by hour')
44
+
45
+ hist_values = np.histogram(
46
+ data[DATE_COLUMN].dt.hour, bins=24, range=(0,24))[0]
47
+ st.bar_chart(hist_values)
48
+
49
+
50
+ hour_to_filter = st.slider('hour', 0, 23, 17) # min: 0h, max: 23h, default: 17h
51
+ filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
52
+ st.subheader(f'Map of all pickups at {hour_to_filter}:00')
53
+ st.map(filtered_data)
54
 
55
  if choice == "Contact":
56
  st.title("You can contact me via:")