Skip to content

mila2023/CityBike_Analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

CityBike_Analytics

WARNING: To run this project download folder CityBikeWeather and run "dotnet run" in the terminal. With that, a new folder will be created in this project, containing a couple of *.csv files from the CityBikes API platform (preferably 8 files in two subfolders).

Files Plan:

Program.cs - main file

WeatherService.cs - helps gather weather data from Open-Meteo API

BikeTrip.cs - defines class for each ride

BikeDataProcessor.cs - loads bike data into list, as well as being resposible for all queries

BikeDataDownloader.cs - downloads files from the CityBikes platform and unzips them

Query Plan:

My computer couldn't possibly hold all months of a year from the CityBikes API, so i picked the coldest and warmest months of the last year and downloaded data from that time window, focusing on analysis I can do using only these two months. It still came out pretty nice:

  1. Are NYC bikers affected by low or high teperatures? Will they pick a different form of transport? Are they more likely to give up when sweating a lake or freezing to the handlebar? As we can see, we can expect little changes when it comes to high temperatures, and large ones in the cold. NYC bikers are apparently scared of ice.

Query 1: Number of rides depending on temperature:

  • Nice: 42915 rides, avg time: 14.3 min
  • Cold (<5°C): 147228 rides, avg time: 9.6 min
  • Very warm (>25°C): 209857 rides, avg time: 13.5 min
  1. How likely are NYC bikers to give up in the rain? As my limit i picked 0.5 cm of rain. That is when the moment becomes rainy. As we can see 1,77 times likely to ride a bicycle without the pleasure of rain on their face (it is worth mentioning that rain becomes snow if the weather is cold enough).

Query 2: Is rain a problem?

  • Rainy: 144060 rides
  • Dry: 255940 rides
  1. Now however, it is time to bring out the real heros of our story, who survived the coldest and windiest of weathers, the longest of time. Here specifically I picked riders who took the longest routes with the temperature below zero and wind speed above 20 km/h. We can also see that regular members are more willing to freeze on their leisure drive.

Query 3: Top 10 strongest heros (wind and ice):

  • Date: 1/10/2025, Duration: 1499.7 min, Temp: -0.8°C (casual)
  • Date: 1/8/2025, Duration: 1265.9 min, Temp: -4.4°C (member)
  • Date: 1/7/2025, Duration: 1141.1 min, Temp: -5.1°C (member)
  • Date: 1/7/2025, Duration: 1079.4 min, Temp: -5.1°C (member)
  • Date: 1/15/2025, Duration: 851.6 min, Temp: -3.4°C (casual)
  • Date: 1/14/2025, Duration: 723.3 min, Temp: -1.9°C (member)
  • Date: 1/14/2025, Duration: 536.9 min, Temp: -1.9°C (member)
  • Date: 1/7/2025, Duration: 500.4 min, Temp: -5.1°C (casual)
  • Date: 1/14/2025, Duration: 447.5 min, Temp: -1.9°C (member)
  • Date: 1/10/2025, Duration: 359.4 min, Temp: -0.8°C (member)
  1. Now, which of our stations are most popular on scorching days? Whether it may be because they are close to the park, in which bikers enjoy their warm days, or because they're close to Starbucks where you can get a nice cold coffee, during heatwaves clients are more likely to search for a bike near these destinations. We now know where to add more bikes, when there are warm days ahead.

Query 4: 5 favorite stations on scorching days:

  • Central Park S & 6 Ave (1416 times was a starting point)
  • Lafayette St & E 8 St (870 times was a starting point)
  • E 33 St & 1 Ave (868 times was a starting point)
  • Broadway & E 21 St (825 times was a starting point)
  • Central Park S & Grand Army Plaza (795 times was a starting point)
  1. It is time to look at the power of will of our users. As we can see, regular members are very determined for their all-year pass to pay back. All in all we can see that in fact, happily, most of our users are members and they are willing to use public bikes even in bad weather conditions, as it is probably their main type of transport.

Query 5: Who will more likely ride in the rain?

  • casual: 25607 rides
  • member: 118453 rides
  1. This next query, tells the Citi Bike logistics team where and when to send "rebalancing" trucks. If you aren't there at 13:45 with a fresh batch of bikes, you're losing money and leaving tourists stranded.

Query 6: Busy stations and their peak hours:

  • Central Park S & 6 Ave - Time: 18:00 - Was a starting point: 201 times

  • E 47 St & Park Ave - Time: 17:00 - Was a starting point: 198 times

  • Central Park S & 6 Ave - Time: 17:00 - Was a starting point: 193 times

  • Central Park S & 6 Ave - Time: 14:00 - Was a starting point: 182 times

  • North Moore St & Greenwich St - Time: 17:00 - Was a starting point: 175 times

  1. Does a gust of wind change our behavior? While we expected a shift toward e-bikes during high winds, the data shows that New Yorkers stay consistent—about 71% of rides are electric regardless of the breeze. However, high wind acts as a massive deterrent overall, slashing total ridership by nearly 85%. It seems that when the wind gets tough, New Yorkers don't just switch bikes, they switch to the subway.

Query 7: Do people choose e-bikes when it's windy?

  • High Wind | electric_bike: 40514 rides
  • High Wind | classic_bike: 16763 rides
  • Low Wind | classic_bike: 99918 rides
  • Low Wind | electric_bike: 242805 rides
  1. This query reveals a fascinating psychological split. On workdays, the average ride time actually increases slightly during rain (12.4 min vs 11.2 min). Workers can't just stop. On weekends, however, rain makes rides shorter. This shows that "Workday" riders are a captive audience. They are a reliable source of income regardless of weather, whereas weekend revenue is highly volatile and weather-dependent.

Query 8: Weather sensitivity of workers and bike enjoyers (Weekend vs Workday):

  • Weekend during Rainy | Avg ride: 12.2 min
  • Weekend during Clear | Avg ride: 14.2 min
  • Workday during Rainy | Avg ride: 12.4 min
  • Workday during Clear | Avg ride: 11.2 min
  1. A loop (starting and ending at the same station) is the ultimate sign of a leisure ride. Data shows that warm weather triples the number of people just riding for the sake of riding. Rain, unsurprisingly, is the ultimate fun-destoyer. These riders are the most likely to buy "Single Trip" or "Day Passes" (the most profitable for Citi Bike). Targeting these stations with ads on warm, dry days is a goldmine.

Query 9: Recreational 'Loops' (same start & end station):

  • Rain: False, Warm: False: 1166 loops found
  • Rain: True, Warm: False: 301 loops found
  • Rain: True, Warm: True: 2318 loops found
  • Rain: False, Warm: True: 3184 loops found
  1. The contrast here is staggering. Average rides per hour drop from over 16,000 to just 115 on holidays. New Yorkers either leave the city or stay firmly on their couches. Maintenance teams should only work on holidays. It’s the only time you can take a station offline without causing a riot.

Query 10: Holiday impact vs Regular days:

  • Is Holiday: True | Avg rides/hour: 115.0
  • Is Holiday: False | Avg rides/hour: 16551.7
  1. This is the "Truck Driver’s Map." We found stations that are "Black Holes" (Deficit - bikes just disappear) and "Gold Piles" (Excess - bikes pile up). Some stations like Canal St & Rutgers St are gaining over 135 bikes a day! This is the most profitable of my queries. Moving bikes from a +135 station to a -22 station is what keeps the system alive. Without this analysis, the system would paralyze within 48 hours. I also found "Zen Stations" (Self Managing) that perfectly balance themselves — the dream of every city planner, that requires no work whatsoever.

Query 11: Stations and their saldo:

--- Not enough ---

  • W 22 St & 10 Ave: -22.10 bikes/day [DEFICIT (station empties)]
  • E 10 St & Ave A: -20.52 bikes/day [DEFICIT (station empties)]
  • E 2 St & Ave A: -16.48 bikes/day [DEFICIT (station empties)]
  • Columbus Ave & W 59 St: -15.97 bikes/day [DEFICIT (station empties)]
  • Henry St & Grand St: -15.65 bikes/day [DEFICIT (station empties)]
  • W 42 St & 6 Ave: -14.55 bikes/day [DEFICIT (station empties)]
  • Division St & Bowery: -14.10 bikes/day [DEFICIT (station empties)]
  • W 42 St & 8 Ave: -12.55 bikes/day [DEFICIT (station empties)]
  • E 85 St & 3 Ave: -11.26 bikes/day [DEFICIT (station empties)]
  • St Marks Pl & 2 Ave: -10.35 bikes/day [DEFICIT (station empties)]

--- Too many ---

  • E 72 St & York Ave: 78.35 bikes/day [EXCESS (bikes accumulate)]
  • E 58 St & 3 Ave: 80.42 bikes/day [EXCESS (bikes accumulate)]
  • Bleecker St & Crosby St: 92.45 bikes/day [EXCESS (bikes accumulate)]
  • Broadway & W 48 St: 95.71 bikes/day [EXCESS (bikes accumulate)]
  • W 20 St & 7 Ave: 101.10 bikes/day [EXCESS (bikes accumulate)]
  • W 15 St & 6 Ave: 115.39 bikes/day [EXCESS (bikes accumulate)]
  • 5 Ave & E 72 St: 116.10 bikes/day [EXCESS (bikes accumulate)]
  • University Pl & E 14 St: 127.26 bikes/day [EXCESS (bikes accumulate)]
  • E 33 St & 1 Ave: 133.58 bikes/day [EXCESS (bikes accumulate)]
  • Canal St & Rutgers St: 135.61 bikes/day [EXCESS (bikes accumulate)]

--- Self Managing Stations ---

  • 61 St & Borden Ave: 0.00 bikes/day
  • Grand Concourse & E 203 St: 0.00 bikes/day
  • 57 St & Grand Ave: 0.00 bikes/day
  • 30 Ave & 96 St: 0.00 bikes/day
  • W Mosholu Pkwy S & Sedgwick Ave: 0.00 bikes/day

About

A college project in C# using LINQ to determine a few fun facts surrounding the topic of bike rides. Enjoy~

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages