This project was completed as part of a Python hands-on analysis for bikeshare data.
This project analyzes bikeshare trip data from three U.S. cities: Chicago, New York City, and Washington. The goal is to explore usage patterns and produce useful statistics such as most common travel times, most used stations, trip durations, and simple user demographics.
This repository contains a terminal (interactive) Python script that:
- Loads a chosen city's data file,
- Allows filtering by month (January–June) and/or day of week (or 'all'),
- Computes summary statistics,
- Shows raw rows on demand,
- Saves session summaries to an Excel file.
Doua Nemier Abd-Alrahman
bikeshare.py— main Python script (interactive).chicago.csv— Chicago dataset (cleaned subset).new_york_city.csv— New York City dataset (cleaned subset).washington.csv— Washington dataset (cleaned subset).city_analysis_result.xlsx— (generated by the script) aggregated session summaries.Bike_Share_Presentation.pptx— PowerPoint presentation summarizing the project and results visually.README.md— this file.
Each CSV is a cleaned extract for January–June 2017 and contains (at least) these columns:
Start Time— trip start timestamp (e.g.,2017-01-01 00:07:57)End Time— trip end timestampTrip Duration— duration in secondsStart Station— name of the start stationEnd Station— name of the end stationUser Type—SubscriberorCustomer
Chicago and New York files also include:
Gender—Male/Female(may containUnknown)Birth Year— year of birth (may contain0for missing)
Washington file does not include Gender / Birth Year.
For the chosen city and filters, the script computes:
-
Popular times of travel
- Most common month (1–6 for January–June)
- Most common day of week
- Most common start hour
-
Popular stations and trips
- Most common start station
- Most common end station
- Most common trip (start → end)
-
Trip duration
- Total trip duration (minutes)
- Mean trip duration (minutes)
-
User info
- Counts of
User Typevalues - Counts of
Gender(if available) - Earliest, most recent, most common birth year (if available)
- Counts of
-
Extras
- Display raw rows 5 at a time on request
- Save session summaries to
city_analysis_result.xlsx
- Open terminal / PowerShell in the repository folder.
- Run:
python compare_cities_final.py
3. Example interaction (user inputs shown in bold):
============================================================
Welcome to the Bike Share Analysis Program
============================================================
Choose a city (Chicago, New York City, Washington): **Chicago**
Choose a month (January to June) or 'all': **all**
Choose a day of the week or 'all': **all**
==================== Analysis Summary ====================
City: Chicago, Month: All, Day: All
Most common month: 6
Most common day: Tuesday
Most common hour: 17
Total trip duration (min): 4681196.45
Mean trip duration (min): 15.60
Most common start station: Streeter Dr & Grand Ave
Most common end station: Streeter Dr & Grand Ave
Most common trip: Lake Shore Dr & Monroe St → Streeter Dr & Grand Ave
User types counts: {'Subscriber': 238889, 'Customer': 61110, 'Dependent': 1}
Gender counts: {'Male': 181190, 'Unknown': 61052, 'Female': 57758}
Earliest birth year: 0
Most recent birth year: 2016
Most common birth year: 0
============================================================
Show 5 rows of raw data? (yes/no): **yes**
... (rows printed in blocks of 5)
Show 5 rows of raw data? (yes/no): **no**
Save session summary to Excel now? (yes/no): **yes**
Results saved to city_analysis_result.xlsx
Restart program for new analysis? (yes/no): **no**
---
Results summary (examples from real runs)
Below are the summary outputs produced when running the provided script with your data. I include both all filters and an example filter (June, Friday) for each city — these match the outputs you shared:
Chicago
All months / All days
common_month: 6
common_day: Tuesday
common_hour: 17
total_duration_min: 4681196.45
mean_duration_min: 15.60
June / Friday
common_month: 6
common_day: Friday
common_hour: 17
total_duration_min: 281743.73
mean_duration_min: 16.83
New York City
All months / All days
common_month: 6
common_day: Wednesday
common_hour: 17
total_duration_min: 4498420.80
mean_duration_min: 14.99
June / Friday
common_month: 6
common_day: Friday
common_hour: 17
total_duration_min: 197518.30
mean_duration_min: 14.73
Washington
All months / All days
common_month: 6
common_day: Wednesday
common_hour: 8
total_duration_min: 6186399.76
mean_duration_min: 20.62
June / Friday
common_month: 6
common_day: Friday
common_hour: 8
total_duration_min: 256471.63
mean_duration_min: 22.20
> Note: Some fields use 0 or N/A to indicate missing values (e.g., birth years or gender missing in Washington). These are preserved exactly as in the cleaned CSV files.