Home → Uncategorized → NYC Taxi Databricks

Uncategorized

Data Processing on a New York City Taxi Dataset with Databricks

January 15, 2023 · Rajat

PS – These projects are from year 2022 – year 2023. Restored these post from old hosting service.

Databricks Notebook Link

1. Introduction

The aim of this project is to analyse the New York Taxicab dataset from January 2019 to April 2022 to answer critical business problem statements — and to create a machine learning model predicting taxi ride fares.

2. Problem Statement

3. Dataset

Since 1971, the NYC Taxi and Limousine Commission (TLC) has published millions of yellow and green taxi trip records: pick-up/drop-off times and locations, distances, rates, payment types, and passenger counts. Yellow cabs hail street passengers citywide (~13,600 medallions); green cabs (since August 2013) improve borough availability.

Yellow vs green taxi coverage

Key fields (yellow: tpep_* datetime; green: lpep_* datetime; otherwise shared): VendorID, pickup/dropoff datetime, passenger_count, trip_distance, PULocationID/DOLocationID, RateCodeID, store_and_fwd_flag, payment_type, fare_amount, extra, mta_tax, improvement_surcharge, tip_amount, tolls_amount, total_amount, congestion_surcharge, airport_fee (yellow), trip_type (green).

4. Architecture

Three core platforms: Azure Blob Storage (data lake; account rajatsinghuts, container bde-at-2), Apache Spark (distributed processing), and Databricks (managed Spark for the full ML lifecycle).

Project process diagram

5. Project Structure and its Processes

7. Business Problems and Solutions

Trips per year/month, busiest weekday/hour, averages per trip and per passenger:

Trips over time results

Duration, distance and speed stats per taxi colour:

Stats per taxi colour

Percentage of trips with tips:

Tip percentage

Of tipped trips, percentage with tips ≥ $10:

Tips over ten dollars

Duration bins (under 5 min … 60+ min): average speed and distance per dollar:

Duration bin analysis

Which bin should a driver target? The 5–10 minute bin — very low average distance per dollar (lower fuel cost) with a substantially high trip count.

Recommended duration bin

8. Machine Learning

ModelTraining RMSE
Linear Regression154.46254572600506
Decision Tree154.47532920782268

9. Conclusion

A linear regression model with test RMSE ≈ 7.08 predicts fares, and all business questions were answered with Spark SQL.

← Newer post Older post →