Basak Tamer commited on
Commit
096a97e
Β·
verified Β·
1 Parent(s): b1b04d7

Upload 6 files

Browse files
Files changed (7) hide show
  1. .gitattributes +2 -0
  2. README.md +23 -0
  3. app.py +92 -0
  4. packages.txt +1 -0
  5. requirements.txt +6 -0
  6. uber-raw-data-sep14.csv +3 -0
  7. uber_race.mp4 +3 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ uber_race.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ uber-raw-data-sep14.csv filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸš– Uber NYC Pulse: Urban Demand Analysis
2
+
3
+ ## **Project Overview**
4
+ This project analyzes **1,028,136 rows** of raw Uber pickup data from New York City (September 2014). By applying temporal feature engineering and interactive visualization techniques, the study identifies critical patterns in urban mobility and dispatch base performance.
5
+
6
+ ## **🧠 Strategic Framework**
7
+ * **Core Algorithm: Temporal Feature Engineering.** Raw timestamps were transformed into descriptive periodsβ€”**The Lull, Morning Rush, Evening Surge, and Nightlife**β€”to provide human-readable context to the 24-hour cycle.
8
+ * **Key Metric: Hourly Trip Density (HTD).** A measure of market pressure used to identify supply-demand gaps across different dispatch bases.
9
+ * **Business Insight:** The **Evening Surge (16:00-19:00)** was identified as the primary revenue driver, suggesting that Uber serves as a vital "after-work" infrastructure in NYC.
10
+
11
+ ## **πŸ“Š Key Features**
12
+ * **Dynamic Racing Bar Chart:** A cumulative visualization showing the hourly competition and growth of the various Uber dispatch bases throughout the month.
13
+ * **Interactive Streamlit Dashboard:** A responsive web interface allowing users to filter data by base and visualize trip distribution dynamically.
14
+ * **Automated Time Labeling:** Custom Python logic used to categorize data into urban activity phases, making technical data accessible for business decision-making.
15
+
16
+ ## **πŸ› οΈ Tech Stack & Configuration**
17
+ * **Language:** Python 3.9+ (Miniconda Environment)
18
+ * **Frameworks:** `Streamlit`, `Pandas`, `Plotly`, `Bar_chart_race`
19
+ * **System Requirements:** **FFmpeg** engine (configured via `packages.txt`) for video rendering.
20
+ * **Deployment:** Hugging Face Spaces.
21
+
22
+ ---
23
+ *Developed by **Basak** as a Capstone project during a 400-hour technical bootcamp, marking a career transition from Business Administration to Data Science.*
app.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import plotly.express as px
4
+ import os
5
+
6
+ # --- PAGE CONFIG ---
7
+ st.set_page_config(page_title="Uber NYC Data Science Project", layout="wide")
8
+
9
+ # --- CUSTOM CSS FOR BRANDING ---
10
+ st.markdown("""
11
+ <style>
12
+ .main { background-color: #f5f5f5; }
13
+ .stMetric {
14
+ background-color: #ffffff;
15
+ padding: 15px;
16
+ border-radius: 10px;
17
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
18
+ border: 1px solid #eeeeee;
19
+ }
20
+ </style>
21
+ """, unsafe_allow_html=True)
22
+
23
+ # --- HEADER SECTION ---
24
+ st.title("πŸš– Uber NYC Pulse: Urban Demand Analysis")
25
+ st.subheader("A Data Science Project by Basak")
26
+
27
+ # --- STRATEGIC OVERVIEW ---
28
+ with st.expander("πŸ“Š View Strategic Executive Summary", expanded=True):
29
+ col_a, col_b, col_c = st.columns(3)
30
+ with col_a:
31
+ st.metric("Core Algorithm", "Temporal Aggregation")
32
+ st.caption("Grouping 1M+ raw timestamps into hourly bins.")
33
+ with col_b:
34
+ st.metric("Key Metric", "Hourly Trip Density (HTD)")
35
+ st.caption("Measuring market pressure and supply-demand gaps.")
36
+ with col_c:
37
+ st.metric("Top Insight", "Evening Surge (17:00)")
38
+ st.caption("Highest revenue potential identified in the 16:00-19:00 window.")
39
+
40
+ # --- DATA LOADING ---
41
+ @st.cache_data
42
+ def load_data():
43
+ try:
44
+ data = pd.read_csv('uber-raw-data-sep14.csv')
45
+ data['Date/Time'] = pd.to_datetime(data['Date/Time'])
46
+ data['Hour'] = data['Date/Time'].dt.hour
47
+ data['DayOfWeek'] = data['Date/Time'].dt.day_name()
48
+ return data
49
+ except Exception as e:
50
+ st.error(f"Error loading data: {e}")
51
+ return None
52
+
53
+ df = load_data()
54
+
55
+ # --- MAIN CONTENT BLOCK ---
56
+ if df is not None:
57
+ st.divider()
58
+ col1, col2 = st.columns([2, 1])
59
+
60
+ with col1:
61
+ st.markdown("### **Demand Pulse by Hour**")
62
+ hourly_data = df.groupby('Hour').size().reset_index(name='Total Trips')
63
+ fig = px.bar(hourly_data, x='Hour', y='Total Trips',
64
+ color='Total Trips', color_continuous_scale='Magma',
65
+ template='plotly_white')
66
+ st.plotly_chart(fig, use_container_width=True)
67
+
68
+ with col2:
69
+ st.markdown("### **Top Dispatch Bases**")
70
+ base_data = df['Base'].value_counts().reset_index()
71
+ fig_pie = px.pie(base_data, values='count', names='Base', hole=0.4)
72
+ st.plotly_chart(fig_pie, use_container_width=True)
73
+
74
+ # --- THE RACING BAR SECTION ---
75
+ st.divider()
76
+ st.markdown("### 🎬 The Race: Cumulative Hourly Growth")
77
+ # This is the line that had the error - ensure it is ONE line:
78
+ st.info("This animation demonstrates the 'Hourly Trip Density' evolution across NYC's dispatch bases.")
79
+
80
+ video_path = 'uber_race.mp4'
81
+ if os.path.exists(video_path):
82
+ with open(video_path, 'rb') as video_file:
83
+ st.video(video_file.read())
84
+ else:
85
+ st.warning("Video file 'uber_race.mp4' not found in this folder.")
86
+
87
+ # --- SIDEBAR ---
88
+ st.sidebar.markdown("---")
89
+ st.sidebar.title("Project Info")
90
+ st.sidebar.write("**Student:** Basak")
91
+ st.sidebar.write("**Focus:** Data Science Transition")
92
+ st.sidebar.write("**Dataset:** 1M+ NYC Uber Pickups")
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ ffmpeg
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ streamlit
2
+ pandas
3
+ plotly
4
+ matplotlib
5
+ seaborn
6
+ bar_chart_race
uber-raw-data-sep14.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c7bda88de4106b5ebeb489545a17b09133a6e5c0efde71d9666d0ee14b7b7d9
3
+ size 47540750
uber_race.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0eb72e1d6bf0190edd3654adcb9d5cc754f0c42b0de28d71444b7c293b9f1730
3
+ size 473789