Skip to content

Latest commit

ย 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿšฒ Citi Bike Data Analytics โ€” Jersey City

End-to-End Python, SQL, PostgreSQL & Geospatial Analysis

An end-to-end data analytics project exploring Citi Bike ridership in Jersey City through Python-based analysis, SQL, PostgreSQL/PostGIS, weather integration, geospatial analytics, and interactive data visualization.

The project evolved from exploratory analysis of Citi Bike trip data into a complete analytical workflow that combines data engineering, statistical analysis, spatial analysis, SQL analytics, year-over-year comparison, and business-oriented insights.


๐Ÿ“Œ Project Overview

The goal of this project is to understand Citi Bike usage patterns in Jersey City and identify the temporal, behavioral, environmental, and geographic factors associated with bike-sharing demand.

The analysis covers:

  • Citi Bike trip patterns and demand
  • Seasonal and monthly trends
  • Member vs. casual rider behavior
  • Hourly and weekday/weekend usage
  • Weather and ridership relationships
  • Station-level activity
  • Popular routes
  • Station departure/arrival imbalance
  • Neighborhood-level activity
  • Geospatial patterns across Jersey City
  • 2025 vs. 2026 ridership changes
  • Business-oriented recommendations

The project combines Python analytics with a relational and spatial database layer, resulting in an interactive portfolio presentation.


๐ŸŽฏ Business Questions

The analysis focuses on several key questions:

Ridership

  • How does Citi Bike demand change throughout the year?
  • Which periods experience the highest and lowest demand?
  • How did ridership change between 2025 and 2026?

Customer Behavior

  • What is the distribution between members and casual riders?
  • Has the user composition changed over time?
  • When are Citi Bike trips most frequently taken?

Weather

  • How does temperature relate to bike usage?
  • Do precipitation and wind conditions affect demand?
  • Can weather help explain daily fluctuations in ridership?

Stations & Routes

  • Which stations generate the most departures?
  • Which stations receive the most arrivals?
  • What are the most popular station-to-station routes?
  • Which stations experience significant departure/arrival imbalance?

Geography

  • Which Jersey City neighborhoods have the highest Citi Bike activity?
  • How does station activity vary spatially?
  • Which areas appear to function as major mobility hubs?

๐Ÿ›  Technology Stack

Programming & Data Analysis

  • Python
  • Pandas
  • NumPy
  • Matplotlib
  • Plotly
  • GeoPandas

Databases & Data Engineering

  • PostgreSQL
  • SQLAlchemy
  • PostGIS
  • Docker

Visualization & Mapping

  • Plotly
  • Folium
  • HTML / CSS / JavaScript

Data Sources & APIs

  • Citi Bike trip data
  • Open-Meteo weather data
  • Jersey City geographic boundary data

Development Tools

  • Jupyter Notebook
  • VS Code
  • Conda
  • Git
  • GitHub

๐Ÿ“ Project Structure

citibike/
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ citibike/
โ”‚       โ”œโ”€โ”€ Citi Bike trip data
โ”‚       โ”œโ”€โ”€ JC2025.csv
โ”‚       โ”‚
โ”‚       โ””โ”€โ”€ processed/
โ”‚           โ””โ”€โ”€ JC2025_Enriched.csv
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ 1_Download_Citibike_Jersey_Data.ipynb
โ”‚   โ”œโ”€โ”€ 2_Data_Enrichment.ipynb
โ”‚   โ”œโ”€โ”€ 3_Weather_Data.ipynb
โ”‚   โ”œโ”€โ”€ 4_Data_Visualization.ipynb
โ”‚   โ”œโ”€โ”€ 5_Neighborhood_Analysis.ipynb
โ”‚   โ”œโ”€โ”€ 6_SQLAlchemy_with_CitiBike.ipynb
โ”‚   โ”œโ”€โ”€ 7_2026_Data.ipynb
โ”‚   โ”œโ”€โ”€ 8_2025_vs_2026_comparison.ipynb
โ”‚   โ””โ”€โ”€ 9_Final_Business_Analysis.ipynb
โ”‚
โ”œโ”€โ”€ postgis_data/
โ”‚
โ”œโ”€โ”€ presentation/
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ script.js
โ”‚   โ””โ”€โ”€ style.css
โ”‚
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ docker-compose.yaml
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

๐Ÿ““ Analytical Workflow

The project is organized into nine analytical stages, progressing from raw data ingestion to final business insights.

Notebook Purpose
1_Download_Citibike_Jersey_Data.ipynb Data acquisition and initial dataset preparation
2_Data_Enrichment.ipynb Data cleaning and feature engineering
3_Weather_Data.ipynb Weather data collection and preparation
4_Data_Visualization.ipynb Exploratory data analysis and visualization
5_Neighborhood_Analysis.ipynb Geospatial and neighborhood-level analysis
6_SQLAlchemy_with_CitiBike.ipynb PostgreSQL, SQLAlchemy and PostGIS integration
7_2026_Data.ipynb 2026 Citi Bike data ingestion and analysis
8_2025_vs_2026_comparison.ipynb Year-over-year comparison
9_Final_Business_Analysis.ipynb Consolidated business analysis and final insights

๐Ÿงน Data Processing & Feature Engineering

The raw Citi Bike trip data was processed and transformed using Pandas.

The workflow includes:

  • Data loading and consolidation
  • Data type conversion
  • Datetime processing
  • Missing-value handling
  • Data quality checks
  • Ride duration calculation
  • Date and time feature extraction
  • Month and season classification
  • Hourly analysis
  • Weekday/weekend classification
  • User-type segmentation
  • Station-level aggregation
  • Route-level aggregation

The processed datasets provide the foundation for both exploratory analysis and database-based analytics.


๐Ÿ“Š Exploratory Data Analysis

The exploratory analysis investigates Citi Bike demand across multiple dimensions.

Temporal Analysis

  • Monthly ridership
  • Seasonal ridership
  • Daily ride patterns
  • Day-of-week patterns
  • Weekday vs. weekend behavior
  • Hourly demand

User Analysis

  • Member vs. casual riders
  • User-type distribution
  • Changes in user composition over time

Station Analysis

  • Top departure stations
  • Top arrival stations
  • Station activity
  • Departure/arrival balance

Route Analysis

  • Most frequently used station pairs
  • High-volume travel corridors
  • Network connectivity patterns

Interactive Plotly visualizations were used throughout the analysis to make patterns easier to explore.


๐ŸŒฆ Weather Data Integration

Weather data was integrated with daily Citi Bike activity using the Open-Meteo Archive API.

The analysis considers environmental variables such as:

  • Temperature
  • Precipitation
  • Rain
  • Snow
  • Wind

Daily Citi Bike demand was merged with corresponding weather observations to investigate relationships between environmental conditions and ridership.

One of the strongest patterns identified in the analysis was the positive relationship between temperature and daily Citi Bike usage.


๐Ÿš‰ Station-Level Analysis

Station activity was calculated by combining trip departures and arrivals.

For each station, the following metrics were analyzed:

  • Total Activity = Departures + Arrivals
  • Net Departures = Departures โˆ’ Arrivals

These metrics help distinguish between:

  • High-volume stations
  • Major departure points
  • Major arrival points
  • Balanced stations
  • Stations with significant network imbalance

Transit-oriented locations emerged as important activity hubs within the Jersey City Citi Bike network.


๐Ÿ”„ Route Analysis

Trip-level records were aggregated into station-to-station routes.

The route analysis identifies:

  • Most frequently used routes
  • Major travel corridors
  • High-volume station connections
  • Potential commuting patterns

Route-level aggregation also provides the foundation for interactive geographic visualization of Citi Bike flows.


๐Ÿ—บ Geospatial Analysis

GeoPandas and PostGIS were used to analyze Citi Bike activity geographically.

The geospatial workflow includes:

  • Station coordinate processing
  • Point geometry creation
  • Coordinate Reference System management
  • Spatial joins
  • Station-to-neighborhood mapping
  • Neighborhood-level aggregation
  • Route mapping
  • Choropleth visualization
  • Interactive station maps

Station coordinates were represented using geographic coordinates and integrated with Jersey City neighborhood boundaries.


๐Ÿ˜ Neighborhood Analysis

Station-level metrics were aggregated by neighborhood to identify broader spatial patterns.

Neighborhood-level metrics include:

  • Number of stations
  • Total departures
  • Total arrivals
  • Total activity
  • Net departures
  • Average activity per station

This provides a more meaningful geographic perspective than looking only at individual station rankings.

The analysis helps identify neighborhoods functioning as:

  • Major mobility hubs
  • Residential demand centers
  • Transit-connected areas
  • High-activity destinations
  • Potentially imbalanced areas

๐Ÿ˜ PostgreSQL, SQLAlchemy & PostGIS

The project was extended with a database layer using PostgreSQL, SQLAlchemy, and PostGIS.

The goal was to move beyond a Pandas-only workflow and demonstrate how analytical datasets can be structured and queried within a relational database.

Database Components

The database contains analytical datasets representing:

Dataset Purpose
Citi Bike trips Ride-level transactional data
Weather Daily environmental observations
Neighborhoods Geographic boundaries
Stations Station-level activity and spatial information

SQLAlchemy provides the connection between Python and PostgreSQL, while PostGIS enables spatial data storage and geographic operations.


๐Ÿงฎ SQL Analytics

The database layer allows analytical questions to be answered directly using SQL.

Examples include:

  • Monthly ride counts
  • Station departures
  • Station arrivals
  • Total station activity
  • User-type analysis
  • Hourly demand
  • Weather-related aggregations
  • Station imbalance
  • Geographic aggregation

Example:

SELECT
    start_station_id AS station_id,
    COUNT(*) AS departures
FROM jersey_city_2026
WHERE started_at >= '2026-02-01'
  AND started_at < '2026-07-01'
GROUP BY start_station_id;

This database-driven approach makes the analysis more scalable and creates a foundation for connecting the data to Business Intelligence tools.


๐Ÿ“ˆ 2025 vs. 2026 Analysis

The project was extended with 2026 Citi Bike data to perform a year-over-year comparison.

The comparison focuses on comparable periods rather than comparing a complete year against a partial year.

The analysis evaluates:

  • Total ridership
  • Monthly demand
  • Member vs. casual behavior
  • User composition
  • Hourly demand
  • Weather relationships
  • Station-level changes
  • Station performance

Key Findings

Overall Ridership 2026 ridership was slightly lower than the comparable 2025 period.

User Composition Casual riders increased their share of total rides, indicating a shift in the composition of Citi Bike demand.

Peak Usage The strongest hourly demand occurred around the evening commuting period, with 17:00 identified as the peak hour.

Weather Temperature showed a strong positive association with daily ridership.

Seasonal Recovery Later months in the analyzed period showed stronger ridership performance, including a notable improvement in June compared with the previous year.


๐Ÿ’ก Key Business Insights

The analysis generated several business-relevant conclusions.

  1. Citi Bike demand is strongly seasonal โ€” Bike-sharing activity increases substantially during warmer periods and declines during colder months.
  2. Weather is an important demand driver โ€” Temperature has a strong relationship with daily ridership, making weather an important factor when interpreting demand fluctuations.
  3. Evening commuting is a major usage pattern โ€” The 17:00 peak suggests a significant commuting component in Citi Bike usage.
  4. Casual usage is becoming more important โ€” The share of casual riders increased in the year-over-year comparison, suggesting potential opportunities for leisure, tourism, and short-term users.
  5. Transit hubs are major mobility centers โ€” Stations near major transportation locations show particularly high levels of activity.
  6. Station imbalance can reveal operational needs โ€” Comparing departures and arrivals can identify stations that may require bike redistribution.
  7. Neighborhood-level analysis reveals broader spatial patterns โ€” Analyzing station activity within neighborhoods provides additional context that cannot be captured by station rankings alone.

๐Ÿ“Š Final Business Analysis

The final stage of the project consolidates the analytical findings into a business-oriented view.

The analysis moves from:

What happened?
      โ†“
Why did it happen?
      โ†“
Where did it happen?
      โ†“
Who is driving the demand?
      โ†“
What factors influence demand?
      โ†“
What could the business do about it?

Potential business applications include:

  • Bike redistribution planning
  • Station capacity planning
  • Seasonal resource allocation
  • Weather-aware demand planning
  • Customer segmentation
  • Casual rider acquisition
  • Geographic expansion decisions

๐ŸŽจ Interactive Data Presentation

The final findings were transformed into an interactive HTML presentation using:

  • HTML
  • CSS
  • JavaScript
  • Plotly

The presentation focuses on data storytelling rather than simply displaying individual charts.

It includes:

  • Executive Summary
  • Key Performance Indicators
  • Monthly Ridership
  • User Type Analysis
  • Weekday / Weekend Patterns
  • Hourly Demand
  • Weather Impact
  • Top Stations
  • Station Performance
  • Network Imbalance
  • Key Business Insights

The presentation is located in:

presentation/
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ script.js
โ””โ”€โ”€ style.css

๐Ÿ” Environment Variables

Database credentials and connection settings are stored in environment variables and are not committed to the repository.

A local .env file is used for database configuration.

Example:

DATABASE_URL=postgresql://user:password@localhost:5432/database

Make sure .env is included in .gitignore.


โ–ถ๏ธ How to Run

1. Clone the repository

git clone https://github.com/arpidata/citibike.git
cd citibike

2. Create the Conda environment

conda create -n citibike python=3.12

3. Activate the environment

conda activate citibike

4. Install dependencies

pip install -r requirements.txt

5. Launch Jupyter Notebook

jupyter notebook

6. Run the notebooks

Follow the analytical workflow in order:

1. Data Download
       โ†“
2. Data Enrichment
       โ†“
3. Weather Integration
       โ†“
4. Data Visualization
       โ†“
5. Neighborhood Analysis
       โ†“
6. PostgreSQL / SQLAlchemy / PostGIS
       โ†“
7. 2026 Data
       โ†“
8. 2025 vs. 2026 Comparison
       โ†“
9. Final Business Analysis

๐Ÿ—„๏ธ Database Workflow

The overall database architecture can be summarized as:

              Citi Bike Data
                    โ”‚
                    โ–ผ
                 Pandas
                    โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚         โ”‚         โ”‚
          โ–ผ         โ–ผ         โ–ผ
       Weather   GeoJSON   Feature
        Data    Boundaries Engineering
          โ”‚         โ”‚         โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ–ผ
             PostgreSQL
                    โ”‚
                 PostGIS
                    โ”‚
                    โ–ผ
              SQL Analytics
                    โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚         โ”‚         โ”‚
          โ–ผ         โ–ผ         โ–ผ
       Temporal  Spatial    Business
       Analysis  Analysis   Analysis
          โ”‚         โ”‚         โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ–ผ
             Visualization
                    โ”‚
                    โ–ผ
          Interactive Presentation

๐Ÿ“š Data

The project uses publicly available Citi Bike trip data for Jersey City, combined with weather observations and geographic boundary data.

The datasets are used for analytical and educational purposes.


๐Ÿš€ Project Evolution

The project was developed incrementally through several stages.

Phase 1 โ€” Python Data Analysis Raw Citi Bike data was cleaned, transformed, and explored using Python and Pandas.

Phase 2 โ€” Weather Integration Weather data was introduced to investigate environmental factors affecting ridership.

Phase 3 โ€” Geospatial Analysis GeoPandas and Folium were used to analyze stations, routes, and neighborhoods.

Phase 4 โ€” Database Engineering The project was extended with PostgreSQL, SQLAlchemy, and PostGIS.

Phase 5 โ€” SQL Analytics Business questions were translated into SQL queries and database-level aggregations.

Phase 6 โ€” 2026 Data Expansion Additional Citi Bike data was incorporated to enable year-over-year analysis.

Phase 7 โ€” Comparative Analysis 2025 and 2026 were compared across ridership, user behavior, temporal patterns, weather, and station performance.

Phase 8 โ€” Final Business Analysis The analytical results were consolidated into actionable business insights.

Phase 9 โ€” Data Storytelling The final findings were presented through an interactive HTML presentation.


๐Ÿง  Skills Demonstrated

This project demonstrates practical experience in:

  • Data Cleaning
  • Data Wrangling
  • Feature Engineering
  • Exploratory Data Analysis
  • Python Programming
  • Pandas
  • SQL
  • PostgreSQL
  • SQLAlchemy
  • PostGIS
  • Geospatial Analytics
  • Statistical Analysis
  • API Integration
  • Weather Data Integration
  • Data Visualization
  • Interactive Visualization
  • Interactive Mapping
  • Business Analysis
  • Data Storytelling
  • Git & GitHub
  • Database-driven Analytics

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Arpenik Mesropyan Radiologist โ†’ Data Analyst

Healthcare professional transitioning into Data Analytics, with a strong interest in:

  • Data Analytics
  • SQL
  • Python
  • Data Visualization
  • Geospatial Analytics
  • Business Intelligence
  • Healthcare Analytics

This project demonstrates the ability to combine domain knowledge, programming, databases, analytical thinking, and visualization to transform raw data into meaningful business insights.


๐Ÿ”— Project Repository

GitHub: https://github.com/arpidata/citibike


โญ If you find this project interesting, feel free to explore the notebooks and interactive presentation.

About

End-to-end Python data analytics project using Citi Bike Jersey City trip data.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages