Data Study on Uber Optimization: Finding Passengers Faster

Posted on May 8, 2018
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.


Ridesharing drivers and companies, such as Uber and Lyft, can make more money by filling their cars with passengers for a higher percentage of the time they are on the road. With this in mind, I designed a Shiny app for New York City rideshare drivers that recommends a destination at which they will likely find passengers faster. The recommendation is based on data such as, the user's current location, time, day of the week and the temperature in NYC.


In 2015, the news and analytics website FiveThirtyEight obtained historical Uber pickups in NYC from the NYC Taxi & Limousine Commission by filing a Freedom of Information Law request. From this data set I used pickups from April - September 2014, as they included GPS coordinates. I supplemented this data set with hourly weather data from NOAA, the National Weather Service Forecast Office.

To review my dataset and code: Github

Data Visualization and Recommendation

After cleaning and merging the data, I plotted each pickup using Leaflet clusters. I added filters so the user can manually limit pickups to those made under specific temperatures, days of the week and times of day. In order to give drivers some insight over time, I added a histogram below the map showing pickups overtime across the city based on the users filter criteria.

Data Study on Uber Optimization: Finding Passengers Faster

The map responds to a user's click, collecting the GPS coordinates at their indicated starting point. I used google's revgeocode function to convert these GPS coordinates into the associated address. Next, I used the function distm to create a new dataset containing all pickups under the user's selected criteria within a quarter mile radius (as the crow flies) of the selected starting point.

In this new dataset (in which each row contains the GPS coordinates of one specific pickup) I added a column with the total number of other pickups in the dataset within a tenth of a mile radius of each respective pickup. I then calculated the row with the maximum value in that column (indicating a high density of other surrounding pickups) and selected the GPS coordinates in that row as the end destination. Finally, I used the function gmapsdistance (Google Maps distance matrix API) to output the time and distance from the starting click point to the ending destination.

Give it a try yourself here:


Data Study on Uber Optimization: Finding Passengers Faster


Future Work

There is a lot more work to be done to improve the quality of the recommendation in my app. I would filter my data using SQLite in order to improve the speed of my app. This would allow me to incorporate all 5.3 million pickups from the original Uber dataset (I had to take a subset to get it to run smoothly in the demo).

Additionally, I would add NYC taxi data in order to have data year-round (Uber only released April - Sept. pickups). This would allow me to expand the weather data filter as variables such as rain, snow and humidity would become more meaningful. I would also factor in events occurring across the city that drive rideshare demand. Finally, I would implement predictive analytics and recommendations for drivers, such as route and time optimization, using machine learning.

About Author

Bennett Gelly

Bennett is a data science fellow at NYCDSA and an MBA candidate at Columbia Business School. He is interested in machine learning-driven business strategy. Bennett brings substantial financial modeling and analytics skills from prior employment in equity research...
View all posts by Bennett Gelly >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI