Jon Solow commited on
Commit
f47916d
·
1 Parent(s): bfa140f

Update app to use fixed league keeper output

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +11 -22
src/streamlit_app.py CHANGED
@@ -1,36 +1,25 @@
1
  import streamlit as st
2
  import pandas as pd
3
- import numpy as np
4
 
5
- st.title("Uber pickups in NYC")
6
 
7
- DATE_COLUMN = "date/time"
8
- DATA_URL = "https://s3-us-west-2.amazonaws.com/" "streamlit-demo-data/uber-raw-data-sep14.csv.gz"
 
 
 
9
 
10
 
11
  @st.cache_data
12
- def load_data(nrows):
13
- data = pd.read_csv(DATA_URL, nrows=nrows)
14
  data.columns = data.columns.str.lower()
15
- data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN])
16
  return data
17
 
18
 
19
  data_load_state = st.text("Loading data...")
20
- data = load_data(10000)
21
- data_load_state.text("Done! (using st.cache_data)")
22
-
23
- if st.checkbox("Show raw data"):
24
- st.subheader("Raw data")
25
- st.write(data)
26
-
27
- st.subheader("Number of pickups by hour")
28
- hist_values = np.histogram(data[DATE_COLUMN].dt.hour, bins=24, range=(0, 24))[0]
29
- st.bar_chart(hist_values)
30
 
31
- # Some number in the range 0-23
32
- hour_to_filter = st.slider("hour", 0, 23, 17)
33
- filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
34
 
35
- st.subheader("Map of all pickups at %s:00" % hour_to_filter)
36
- st.map(filtered_data)
 
1
  import streamlit as st
2
  import pandas as pd
 
3
 
 
4
 
5
+ LEAGUE_NAME = "LOFG"
6
+ DATA_URL = "../tests/mocks/2023_keepers.csv"
7
+
8
+
9
+ st.title(f"{LEAGUE_NAME} Keeper Options")
10
 
11
 
12
  @st.cache_data
13
+ def load_data():
14
+ data = pd.read_csv(DATA_URL, index_col=0)
15
  data.columns = data.columns.str.lower()
 
16
  return data
17
 
18
 
19
  data_load_state = st.text("Loading data...")
20
+ data = load_data()
21
+ data_load_state.text("Data loaded")
 
 
 
 
 
 
 
 
22
 
 
 
 
23
 
24
+ st.subheader("Raw data")
25
+ st.write(data)