--- title: Citi Bike Rebalance Operations Analysis subtitle: The secrets behind fulfilling bike demand author: Rishi Goutam, Srikar Pamidi, James Goudreault author-url: 'https://github.com/rishigoutam/citibike' date: '2022-04-01' abstract: In this article, we show how we analyzed bike rebalances, based on station ridership, capacity, elevation, and time of day keywords: Citi Bike; NYC Data Science Academy --- <!-- Introduction --> Citi Bike operations face a daily problem—how to ensure a consistent supply of bikes are available for riders at each dock station? Also, how to ensure that there are spots available to receive bikes at destination stations? In this article, we discuss how we analyzed the Citi Bike [trips](TODO) and [stations](TODO) datasets to answer these questions. By "reading between the *dataset* lines" we can reveal how Citi Bike satisfies rider demand for bikes. To understand the user side of the story, take a look at our previous [article](TODO), where we analyzed rider behavior and created a model to predict trip demand. ## Introduction ### What is rebalancing? Why do we care? Consider the flow of bikes through a popular commuter station–E 24 St & Park Ave S–on Monday, September 9, 2019. The station has a maximum capacity of 54 bikes. However, there are more bikes being ridden out of the station than coming in. Even if the station were to start out the day fully-stocked, it would get depleted halfway through the morning commuter rush hour. A significant number of riders would be without a bike! This would quickly lead to dissatisfied members canceling their subscriptions. ![](https://hackmd.io/_uploads/B1GSwC64c.png) ![Line graph showing bike flow through an example commuter station on a Monday](commuter-station-bike-flow.png) How is this possible? Through the Citi Bike operations team's rebalancing efforts. Citi Bike manually moves bikes from one station to another to: - Ensure there are sufficient bikes to satisfy predicted demand - Ensure there is a spot for a bike at each station to receive incoming bikes - Minimize the number of unused bikes sitting at unpopular stations ### How does Citi Bike rebalance bikes? Citi Bike employs several methods to manage rebalancing needs: - *Valet Service* - employees staff popular stations to manage incoming and outgoing bikes, artificially increasing station capacity and temporarily alleviating rush-hour problems - *Bike Trains* - employees ride ebikes towing carriages of 12-16 bikes—ideal for going in and around tight neighborhood streets - *Motorized Vehicles* - higher-capacity vans operate 24/7 to keep bikes moving to and from the most popular stations - *Bike Angels* - launched in 2018, this program grants Citi Bike riders (non-employees) traveling along in-demand rebalance routes a free trip and reward points ### Identifying Rebalance Movements The Citi Bike trips dataset does not contain information on individual bike rebalances. Nor is that generally available online except as aggregated data in [monthly reports](TODO). So, how can someone tell when and where a bike was rebalanced? ![](https://hackmd.io/_uploads/r1Bfjj24q.png) ![Image showing methodology to identify a rebalanced bicycle](identifying-rebalances.png) The easiest method for a given bike is to compare the starting station for each trip with the ending station of the previous trip. If the bike appears to have teleported from one station to another between trips, it most likely was rebalanced! ## Analyzing the Data We focus our exploratory data analysis on: - Basic statistics - The impact of the bike angel program - When and where bikes are rebalanced - And the impact of station elevation on rebalancing Then, we explore how this data could be used to reverse-engineer actual rebalancing operations. Finally, we visualize the data over maps of New York City. ### Visualizing dock stations and bike rebalancing To aid our exploratory data analysis, we built the below tool to show station information. Hover over the stations to see station name, elevation, number of trips taken from that station in 2019, and number of bike rebalances that year. <!-- TODO add iframe station info <iframe> title="foo" src="https://chart-studio.plotly.com/~plotlygoutamorg/5.embed" width="700" </iframe> --> You can check out our [python dash application](https://citibike.goutam.io/) for more information. ### Rebalance Operations The number of trips rebalanced by Citi Bike increased with general ridership for the first few years after the 2013 launch in NYC. But, in 2018, it drops dramatically. This coincides with the introduction of the Bike Angels program and illustrates just how effective it was. <!-- side by side two images --> ![](https://hackmd.io/_uploads/SyBfhj3E5.png) ![Bar chart showing annual rebalances](annual-rebalances.png) ![](https://hackmd.io/_uploads/SJXhsjh4q.png) ![Bar chart showing annual rides vs rebalances](rides-vs-rebalances.png) We also found that almost every bike in service was rebalanced at least once each year and almost every station was involved in rebalancing operations. See [here](TODO link to relevant lines https://github.com/rishigoutam/citibike/blob/main/eda/rebalance_eda.ipynb). We wanted to see where bikes were being rebalanced, so we faceted the data by NYC borough. The vast majority of trips are in Manhattan, so it is not surpising to see that the majority of rebalances are also there. Most bikes are rebalanced from one Manhattan station to another. However, there is still considerable effort required to move bikes across boroughs. Below, we see a log graph of bikes rebalanced. Without the log transformation, Manhattan would dwarf all other boroughs. ![](https://hackmd.io/_uploads/ryYuFUc79.png) ![Bar chart showing number of rebalances within and between boros](rebal-boro-blog.png) We can see the same information visually. Here, we see that Manhattan has all of the top 100 stations by trips. ![](https://hackmd.io/_uploads/rkZ3CkC49.png) And the the same is true for stations ranked by number of bikes rebalanced *from* and *to* that station. <!-- side by side --> ![](https://hackmd.io/_uploads/B1LnaJAV9.png) ![](https://hackmd.io/_uploads/ByJcAkRNc.png) Stations with the highest rebalance activity mostly serve commuters traveling from home to work. These home-to-work station pairs often have bikes being rebalanced in both directions. In the mornings, a high number of trips are made from the "home" station to the "work" station and so bikes have to be rebalanced in the opposite direction to maintain supply. In the evening, the reverse problem is faced by the Citi Bike bike operations team. We see the pattern exhibited in the chart below. ![](https://hackmd.io/_uploads/rJroqds4q.png) ![bar charts showing relationship between top to and from rebalance stations](to-from-top-stations.png) ### Seasonality Prior to the launch of the Bike Angel program, bike rebalances followed a similar seasonal pattern to trip demand, with considerably more activity in the summer months. Post-launch, this seasonality still exists, but to a much lower degree. ![](https://hackmd.io/_uploads/BJWYw10Nc.png) ![Line graph showing annual rebalances per month](annual-seasonality.png) We also found that the Bike Angel program reduced rebalance needs on weekends relative to the rest of the week. <!-- ![Weekly Seasonality](https://hackmd.io/_uploads/Sy8NkdsNc.png) --> ### Rebalance Timing When does Citi Bike rebalance bikes? The data doesn't tell us when a bike was rebalanced—only when the next trip started after the bike was rebalanced. Therefore our rebalance timing estimates (in hours) reflect the maximum timeframe in which the rebalance could have occurred. While not perfect, we will assume Citi Bike does not needlessly rebalance bikes and this data is fairly representative of actual movements. Aggregate data shows there is clear need to move bikes for immediate use within the next hour or two, as well as overnight rebalancing to prepare for the morning commute. We see this as bikes rebalanced as used pretty quickly after being rebalanced in the graph below. ![](https://hackmd.io/_uploads/H1JrF22Nc.png) ![Bar chart showing rebalance timing](overall-rebal-timing.png) There was a considerable drop in immediate-use rebalances following the launch of the Bike Angel program in 2018. This may also be the result of improvements to the Valet Service, allowing a commuter station to "overflow" with bikes that are then moved in bulk overnight. ![](https://hackmd.io/_uploads/ryLngtjV5.png) ### Station Elevation We wanted to find out how station elevation plays an effect on rebalancing. While NYC is close to sea level, there still exist hilly areas that can be a pain to climb. Our hypothesis was that bikers generally do not want to bike uphill, so stations that are at high elevations would have more bikes taken out than coming back in. So, Citi Bike would have to lug these bikes back up to the higher elevation stations. We found that, in aggregate, more bikes were rebalanced to higher-elevation stations than away from them. The opposite is true for lower-elevation stations. This suggests that bikers who ride downhill sometimes find other modes of transport for return trips, not wanting to ride the heavy Citi Bikes back uphill. With Citi Bike electrifying its fleet, this pattern might go away as riders use ebikes. ![](https://hackmd.io/_uploads/HkreVnnN9.png) ![Bar chart showing bikes to and from stations grouped by elevation](station-elevation.png) In the below graph, we see that the there are more bikes rebalanced to higher-elevation stations (the area under the right half of the distribution) than to lower-elevation station (the area under the left half of the distribution). In 2016 (pre-implementation of the Bike Angels program), there are more bikes rebalanced than in 2019. But also, notice that in addition to the change in number of trips, there is a change to the distribution–the curve flattens out and shifts right, indicating that a larger percentage of bikes are rebalanced to higher-elevation stations in 2019 than earlier. This behavior of avoiding uphill trips carries over to Bike Angel customers. Even a free trip isn't enough incentive to pedal uphill. ![](https://hackmd.io/_uploads/By422Vqm9.png) ![Density plot showing rebalance change in elevation pre and post bike angel launch](rebal-elev-density.png) ## Investigating rebalance routes We can glean more information about how Citi Bike rebalances bikes if we consider movement between a pair of stations as a "rebalance route" rather than looking at just individual stations. ### Top routes for bike rebalancing The vast majority of rebalance activity occurs between a small number of station pairs in Manhattan. This makes sense in the context of commuter bike usage, where there is a need for a constant flow of bikes away from destination stations to origin stations to keep up with demand. ![](https://hackmd.io/_uploads/BJCcDOsVc.png) ![Bar chart of top 10 rebalance routes, with distribution and elevation change](top-10-rebal-routes.png) Notice some of the top routes are just the reverse direction of each other. Visualizing bi-directional flow between station pairs further emphasizes how critical rebalance operations are between a small number of station pairs. If Citi Bike focuses on keeping these routes properly balanced, the majority of ridership demand would be satisfied. ![](https://hackmd.io/_uploads/B1rtO_oVq.png) ![Bar chart of top 10 bi-directional rebalance routes](top-10-bidirectional-rebalance-routes.png) We visualized the top station pairs for 2019. Hover over the arcs to see the delta bikes rebalanced between a station pair. The arc thickness indicates number of bikes rebalanced and color indicates direction (blue=from; red=to) We see two main patterns: 1. Bikes are moved from lower Manhattan to the Upper West Side along long routes. Ideally, Citi Bike rebalances these routes using vans. 2. There are a lot of station pairs clustered in the East Village. Some station pairs are just a couple of blocks apart, so Citi Bike can manually rebalance these stations or use bike trolleys. <!-- TODO add arcs iframe --> ### When are routes rebalanced? Investigating rebalance timing of the top 5 stations by number of bikes rebalanced reveals that not all are managed in the same way. Some seem to have the majority of rebalances done overnight while others seem to be more frequently rebalanced for immediate use. ![](https://hackmd.io/_uploads/rJmwlThE9.png) ![Bar charts of rebalance timing for top 5 individual stations](rebal-timing-top-5-stations.png) If we focus on a single station, for example E 10 St & Avenue A, and look at its top rebalance routes, we can see there are distinct uses for each one. For this station, rebalancing from Cooper Square & E 7 St is typically done to satisfy immediate use demand, while rebalancing from E 14 St & Avenue B almost exclusively is done to fill the station during hours of low activity. ![](https://hackmd.io/_uploads/r1jWzcoN9.png) ![Bar charts showing how two stations feed another at different times](station-rebalance-timing-example.png) It should be noted that rebalance operations are probably more nuanced than bikes being moved along static routes involving only two stations. A van might stop at several stations along a circuit—picking up or dropping off bikes at each one. ## Future Work There are endless ways to dive into trip and rebalance data to understand needs and motivations of bike-share participants or the general movement of individuals around New York. This analysis focused mostly on data aggregated over the years available (2014-2000) which helps us interpret rebalance operations as a whole. Other future work could include: - Create a model to predict when a station needs to be rebalanced - Identify an actual route a Citi Bike van employee might take to rebalance bikes. Adapt the traveling salesman problem to bike stations. Time of day needs to be taken into consideration as different stations have different times they need to be visited. - Focusing on a specific year, season, or days to understand and predict usage and rebalance needs with respect to changes in overall ridership and events such as holidays and professional sports games - Cost analysis of rebalancing and savings from Bike Angels and Valet Service programs - Comparison of rides and rebalance statistics across years as docking stations are introduced, moved, or retired to evaluate past decisions and inform future strategy ## Conclusion Citi Bike's operation team has a difficult problem to solve and they do so every hour of every day of every year across a wide geographic region to keep members happy. They are helped significantly by the Bike Angels program in their efforts, but even those intrepid riders are put off by rebalancing to high-elevation stations. The Bike Angels program also helped to flatten the rebalancing need, particularly immediate-use rebalancing, and also reduced seasonality. We identified the top routes as well, which Citi Bike could focus on as per the Pareto principle. We hope this analysis was helpful in understanding Citi Bike's rebalancing operations. If you haven't already, check out our previous articles on [predicting Citi Bike trip demand](TODO) or [predicting property sale price in Ames, Iowa](TODO). Also, take a look at our [Citi Bike app](https://citibike.goutam.io/)!