alpergel commited on
Commit
0cf9c0e
1 Parent(s): f9daa84
Files changed (2) hide show
  1. app.py +8 -38
  2. ipc.csv +5 -0
app.py CHANGED
@@ -30,17 +30,17 @@ st.set_page_config(layout="wide", page_title="NYC Ridesharing Demo", page_icon="
30
  # LOAD DATA ONCE
31
  @st.cache_resource
32
  def load_data():
33
- path = "uber-raw-data-sep14.csv.gz"
34
- if not os.path.isfile(path):
35
- path = f"https://github.com/streamlit/demo-uber-nyc-pickups/raw/main/{path}"
36
 
37
  data = pd.read_csv(
38
  path,
39
  nrows=100000, # approx. 10% of data
40
  names=[
41
- "date/time",
42
- "lat",
43
- "lon",
 
44
  ], # specify names directly since they don't change
45
  skiprows=1, # don't read header since names specified directly
46
  usecols=[0, 1, 2], # doesn't load last column, constant value "B02512"
@@ -56,7 +56,7 @@ def load_data():
56
  def map(data, lat, lon, zoom):
57
  st.write(
58
  pdk.Deck(
59
- map_style="mapbox://styles/mapbox/light-v9",
60
  initial_view_state={
61
  "latitude": lat,
62
  "longitude": lon,
@@ -159,36 +159,6 @@ with row2_1:
159
  )
160
  map(filterdata(data, hour_selected), midpoint[0], midpoint[1], 11)
161
 
162
- with row2_2:
163
- st.write("**La Guardia Airport**")
164
- map(filterdata(data, hour_selected), la_guardia[0], la_guardia[1], zoom_level)
165
-
166
- with row2_3:
167
- st.write("**JFK Airport**")
168
- map(filterdata(data, hour_selected), jfk[0], jfk[1], zoom_level)
169
-
170
- with row2_4:
171
- st.write("**Newark Airport**")
172
- map(filterdata(data, hour_selected), newark[0], newark[1], zoom_level)
173
 
174
  # CALCULATING DATA FOR THE HISTOGRAM
175
- chart_data = histdata(data, hour_selected)
176
-
177
- # LAYING OUT THE HISTOGRAM SECTION
178
- st.write(
179
- f"""**Breakdown of rides per minute between {hour_selected}:00 and {(hour_selected + 1) % 24}:00**"""
180
- )
181
-
182
- st.altair_chart(
183
- alt.Chart(chart_data)
184
- .mark_area(
185
- interpolate="step-after",
186
- )
187
- .encode(
188
- x=alt.X("minute:Q", scale=alt.Scale(nice=False)),
189
- y=alt.Y("pickups:Q"),
190
- tooltip=["minute", "pickups"],
191
- )
192
- .configure_mark(opacity=0.2, color="red"),
193
- use_container_width=True,
194
- )
 
30
  # LOAD DATA ONCE
31
  @st.cache_resource
32
  def load_data():
33
+ path = "ipc.csv"
34
+
 
35
 
36
  data = pd.read_csv(
37
  path,
38
  nrows=100000, # approx. 10% of data
39
  names=[
40
+ "Lat",
41
+ "Lon",
42
+ "Number",
43
+ "Tract",
44
  ], # specify names directly since they don't change
45
  skiprows=1, # don't read header since names specified directly
46
  usecols=[0, 1, 2], # doesn't load last column, constant value "B02512"
 
56
  def map(data, lat, lon, zoom):
57
  st.write(
58
  pdk.Deck(
59
+ map_style="mapbox://styles/mapbox/dark-v9",
60
  initial_view_state={
61
  "latitude": lat,
62
  "longitude": lon,
 
159
  )
160
  map(filterdata(data, hour_selected), midpoint[0], midpoint[1], 11)
161
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
  # CALCULATING DATA FOR THE HISTOGRAM
164
+ #chart_data = histdata(data, hour_selected)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ipc.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Lat,Lon,Number,Census Tract #
2
+ 33.36607,-111.96315,26814,4013320002
3
+ 33.370236,-111.971805,55927,4013116738
4
+ 33.369961,-111.953024,40759,4013320007
5
+ 33.354334,-111.95699,37540,4013320001