Uber-Style Ride Data Analysis Project

Data Science project 15

Uber-Style Ride Data Analysis Project

Build a complete uber data analysis workflow with reproducible Python code, traceable calculations, validation checks, and honest limitations.

Explore Data Science training in VizagView all project ideas

Analysis question

How do request volume, completion rate, and completed fare vary by hour in a demonstration ride-hailing operation?

Dataset

Three thousand synthetic ride-hailing requests created locally, with request time, distance, fare, and completed or cancelled status. No Uber data is used.

Requirements

  • Python 3.10 or later
  • A terminal or command prompt
  • python -m pip install numpy pandas
  • About 45-60 minutes to build and review

Method and data checks

Extract request hour, create a completed flag, zero out cancelled fare for the completed-fare measure, calculate overall KPIs, and aggregate hourly operations.

  • Requests and completed rides are not confused
  • Cancelled fares are excluded from completed fare
  • All 24 hours reconcile to total requests
  • The page states that the project is not affiliated with Uber

Complete Python code

Save the program as ds_uber_data_analysis.py. The dataset generator or loader, analysis functions, output, and reproducibility controls are included.

"""Ride-hailing operations analysis using synthetic, non-Uber data."""

from __future__ import annotations

import numpy as np
import pandas as pd


def make_demo_rides(n: int = 3_000, seed: int = 42) -> pd.DataFrame:
    rng = np.random.default_rng(seed)
    requested = pd.Timestamp("2025-06-01") + pd.to_timedelta(rng.integers(0, 30 * 24 * 60, n), unit="m")
    distance = np.clip(rng.gamma(2.2, 3.4, n), 0.8, 35)
    peak = pd.Series(requested).dt.hour.isin([8, 9, 17, 18, 19]).to_numpy()
    cancelled = rng.random(n) < np.where(peak, 0.13, 0.07)
    fare = 55 + 17 * distance + peak * 45 + rng.normal(0, 20, n)
    return pd.DataFrame({"ride_id": range(1, n + 1), "requested_at": requested, "distance_km": distance.round(2), "fare": np.maximum(fare, 50).round(2), "status": np.where(cancelled, "cancelled", "completed")})


def analyse_rides(data: pd.DataFrame) -> tuple[dict[str, float], pd.DataFrame]:
    rides = data.copy()
    rides["hour"] = pd.to_datetime(rides["requested_at"]).dt.hour
    rides["completed"] = rides["status"].eq("completed")
    rides["completed_fare"] = rides["fare"].where(rides["completed"], 0)
    hourly = rides.groupby("hour", as_index=False).agg(requests=("ride_id", "size"), completion_rate=("completed", "mean"), completed_fare=("completed_fare", "sum"))
    kpis = {"requests": float(len(rides)), "completion_rate": float(rides["completed"].mean()), "average_completed_fare": float(rides.loc[rides["completed"], "fare"].mean())}
    return kpis, hourly


def main() -> None:
    kpis, hourly = analyse_rides(make_demo_rides())
    print({k: round(v, 3) for k, v in kpis.items()})
    print(hourly.sort_values("requests", ascending=False).head(8).round(3).to_string(index=False))
    print("Synthetic ride-hailing data; not affiliated with or sourced from Uber.")


if __name__ == "__main__":
    main()

Run the project

  1. Create and activate a virtual environment.
  2. Install dependencies with python -m pip install numpy pandas.
  3. Run python ds_uber_data_analysis.py.
  4. Reconcile row counts and totals before interpreting patterns.
  5. Read the limitations before substituting any real dataset.

Expected analytical output

Total requests, completion rate, average completed fare, and an hourly operations table.

Interpretation and responsible-use limits

This is synthetic ride-hailing data and is not sourced from, endorsed by, or affiliated with Uber. Real mobility analysis requires lawful data access, privacy protection, location safeguards, and operational definitions.

Ways to extend the project

Add pickup zones at a safe aggregation level, trip duration, driver supply, weather, events, confidence intervals, and privacy-reviewed geospatial maps.

Continue learning Data Science

Try the next project, return to the Softenant project library, or explore the Data Science course in Vizag for guided data cleaning, analysis, visualisation, and portfolio feedback.