Skip to content

DouaNemier/Bikeshare

Repository files navigation

Bike Share Project

This project was completed as part of a Python hands-on analysis for bikeshare data.

Overview

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.

Author

Doua Nemier Abd-Alrahman


Files in this repository

  • 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.

Data description

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 timestamp
  • Trip Duration — duration in seconds
  • Start Station — name of the start station
  • End Station — name of the end station
  • User TypeSubscriber or Customer

Chicago and New York files also include:

  • GenderMale / Female (may contain Unknown)
  • Birth Year — year of birth (may contain 0 for missing)

Washington file does not include Gender / Birth Year.


What the script computes

For the chosen city and filters, the script computes:

  1. Popular times of travel

    • Most common month (1–6 for January–June)
    • Most common day of week
    • Most common start hour
  2. Popular stations and trips

    • Most common start station
    • Most common end station
    • Most common trip (start → end)
  3. Trip duration

    • Total trip duration (minutes)
    • Mean trip duration (minutes)
  4. User info

    • Counts of User Type values
    • Counts of Gender (if available)
    • Earliest, most recent, most common birth year (if available)
  5. Extras

    • Display raw rows 5 at a time on request
    • Save session summaries to city_analysis_result.xlsx

Example of running the program (interactive)

  1. Open terminal / PowerShell in the repository folder.
  2. 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.

About

Bike Share Data Analysis Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages