How NYC is moving around differently since the onset of the COVID pandemic

Posted on Nov 24, 2022


The outbreak of the COVID-19 pandemic in 2020 caused a public health crisis, and affected the economy significantly, especially at its early stage. Meanwhile, it also led to changes in people’s mobility and lifestyle during the pandemic period.

The focus of this project is to closely examine those changes in NYC residents’ mobility behaviors and explore how they are impacted by COVID.

New York City has 5 boroughs, Brooklyn, Queens, Manhattan, the Bronx and Staten Island. It is important to make the comparisons through the perspective of boroughs instead of the entire city itself, because populations, cultures and functions are vastly different across boroughs in NYC.



Data are collected from multiple resources,

  • Mobility data from Google COVID-19 Community Mobility Reports
  • COVID-19 data published by NYC Health Department
  • Census data from the US Census Bureau

Mobility Data

The mobility data used are from a subset of the Google mobility data on the five counties (New York, Kings, Bronx, Richmond and Queens), equivalent to the five boroughs of New York. The dataset records the daily mobility changes compared to a baseline for 6 categories,

  • Retail and Recreation
  • Grocery and Pharmacy
  • Parks
  • Transit Stations
  • Workplaces
  • Residential

The mobility change is defined as the percentage change in the number of visits (first 5 categories) or length of stay (residential). And the baseline is the median for the corresponding day of the week over a five-week period from Jan 3 to Feb 6, 2020.

COVID-19 Data

For the COVID-19 data, I collected the daily borough-specific counts of confirmed cases, hospitalizations, and death counts. I also added the vaccination data over time by borough.

Census Data

The latest population of each NYC borough is collected from the 2020 census. This was joined to the COVID data to normalize the counts.


Data Pre-processing

The pre-processing involves converting data types and handling missing values.

Three major additional procedures were applied to data,

  • Joined borough population data to covid data
  • Generated percentages of the population that are newly confirmed, hospitalized, dead, or fully vaccinated
  • Classified weekdays and weekends for Workplaces and Residential. Preliminary analysis indicated that both categories have clear differences in the level of mobility changes between weekdays and weekends. Thus, they were split into weekdays and weekends in the following analysis.



The following plot is a brief overview of the city-wide COVID trend.

There were major spikes at the outbreak of the pandemic, in early 2021 (Alpha variant), and end of 2021 (rise of Omicron). In the following analysis, each category generally follows the same 3-stage pattern corresponding to the COVID spikes observed here.

Part 1 - NYC by category

Retail & Recreation

  • Overall, all boroughs show a clear upward recovery trend but are still lower than the pre-COVID level
  • Among all boroughs, Manhattan was most heavily impacted, with the mobility level dropping by nearly 90% at the start of the pandemic, while all other boroughs declined by around 60-70%. Even as time went by, Manhattan’s level of decline was always double of the other boroughs.

Grocery & Pharmacy

  • In terms of the trends and scales, this is the least impacted category. This makes intuitive sense as people visit these places to purchase necessities. Manhattan was the most impacted borough, while Queens was the least affected and its mobility level has recovered to pre-COVID level. 


  • Visits to parks are typically under the impact of weather and temperature. Even with COVID disrupting people’s habits, the seasonality factor remains, as we observe peaks in summer and early fall time. Brooklyn and Queens especially have very high variations between levels in summer and winter.
  • In addition, compared with the baseline (January 2020), the same periods in 2021 and 2022 are still lower, as it takes time to rebuild confidence following the pandemic.

Transit Stations

  • Transit stations were heavily impacted during the pandemic, with Manhattan suffering the largest decline from the baseline. The difference among boroughs is not as large as in some categories, and it remains to be seen whether the decline is there to stay as people have new preferences to commute post-COVID.


For workplace mobility change on weekdays, it is not surprising that it was impacted the most. Manhattan’s mobility decreased the most, while the other boroughs all declined by similar levels.

Starting in mid-2021, the change stabilized at a new level that is below the baseline. It is logical to deduce that negative mobility changes are expected to last for a while as remote and hybrid work models have become the new norm.

As for weekends, it shows a slightly different picture. There was a dramatic fall at first, but since 2H 2020, mobility has already shown a trend of stabilization.

A possible explanation for this could be that the majority of those who work on weekends did not have the flexibility to choose a remote work model, such as those who work in the service industry and work as temp workers.


The only category in which mobility increased is residential. Intuitively, the shorter time you spend outside means longer time at home.

For weekdays, all boroughs experienced major increases at first before plateauing, and the inter-borough variations were the smallest compared to other categories.

Weekends tell a similar story except during summertime. There were some negative changes that occurred during the summer of 2021 & 2022.


To summarize, residents in different boroughs acted differently during the pandemic, with Manhattan being the one with the most changes across categories. Thus, in the next step, the analysis focused on Manhattan and identified the correlations between its changes in mobility behaviors and the development of COVID.

Part 2 – Manhattan in focus

To explore the synchrony of mobility change and development of covid, visualize mobility changes, newly confirmed cases, and daily death count over time.

There were large changes in mobility behaviors upon major COVID spikes for all categories. Meanwhile, consistent with the previous analysis, residential mobility change is positively correlated with COVID stats, while all others are negatively correlated.

As for the death rate, the largest peak occurred as part of the original wave, and the much smaller peak in January 2022 was a result of the Omicron variant. The most recent outbreak caused the case count to spike but only slightly increased the death rate, and this coincided with a mild decline in mobility.

To quantify the synchrony among all the mobility behaviors and COVID categories, I set a cutoff date at end of Nov 2021 and split the data into pre-Omicron and post-Omicron periods. The Omicron variant, which was vastly different from all others in its transmissibility and severity, was first reported in early December in NYC and across the US.

Looking at the pre-Omicron correlation matrix, a strong relationship was found in the 3 Covid statistics (death, hospitalization and case %):

Death rate has the largest (most negative) correlation with most of the mobility categories. Hospitalization rate and infection rate (case percentage) follow. All three rates have positive correlations with the Residential category.

Vaccination percentage is the exact opposite, with the highest correlation with Retail & Recreation (+0.92) and Transit (+0.84). And close to -0.9 with Residential.

Since the Omicron outbreak, the correlation of death/hospitalization/infection rates with Parks, Retail & recreation, and Grocery all decreased significantly. The two exceptions were Workplace (esp. weekdays) and Residential (esp. weekdays). Both showed stronger correlations with cases, deaths & hospitalization, and weaker correlations with Vaccination percentage.

R Shiny App

An interactive R Shiny app called “Empire State of Mind” is created to visualize all the analyses and comparisons conducted above, both by category and by borough. It also allows users to easily play around with different boroughs and cut-off dates for correlation analysis with different COVID stats.


Next Step

  • Build up prediction models incorporating time-series effects, COVID conditions and other possible factors.
  • Add more interactive functionalities to the shiny app (e.g. allow users to check mobility and covid stats based on one selected date) and even expand to other major cities in US.

About Author

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