Data Web Scraping Happiest States in America

Posted on Apr 17, 2017
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.


Some of my friends have moved out of D.C. metro area during the past several years, mostly for better job & business opportunities or more affordable houses. During the same period of time, I have come across some people who relocated to D.C. area for almost identical reasons. Conversations with friends and newcomers informed me that while some had happily settled down quite a few other people are contemplating the next move, hoping to find more happiness in another new place, and that got me wondering about what states are home to happiest people. A report titled "2016's happiest states in America" on provides the very data that I'm looking for.


The report compared the 50 states and the District of Columbia using 28 metrics across three dimensions: physical & emotional wellbeing, work environment and community & environment. The Wallethub analysts then calculated overall scores for each state using the weighted average across all metrics, which were then used to construct the final ranking. The data used for ranking were collected from the organizations including US Census Bereau, Bereau of Labor Statistics, and etc. I used Selenium to scrape the data.

Below is a snapshot of the data I've got:

Data Web Scraping Happiest States in America

Based on the data, I created a map with R and package "maps" to display total scores of each state and a bar graph with Python comparing total rank, physical & emotional wellbeing rank, and work environment rank among the states.

Data Analysis

Data Web Scraping Happiest States in America

On the map, the darker the state, the happier people are. Apparently Utah, Minnesota, North Dakota, Colorado and Idaho are some of the states where happiest people reside in. Notice package" Maps" excludes Hiwaii and Alaska from US map, so Hiwaii isn't shown here, although it is one of the happiest states based on total score.

However the total score is kind of misleading.  A state's impressive total score of happiness doesn't tell the whole story of its residents. Take a look at residents' physical & emotional rank, work place rank as well as the total rank of the top ten happiest states based on total score:

Data Web Scraping Happiest States in America

The graph shows some surprising and interesting findings. Many states that scored highly in total score (total rank), lagged behind in physical & emotional wellbeing or work environment rank. Colorado which scored 5th place in overall rank, placed only 18th in work environment rank. Idaho, the fifth runner-up in overall rank, was only 24th in emotional and physical wellbeing rank. It is safe to say that, before making the move, people should make sure their expectations align with what the destination states have to offer, otherwise they won't be happy.

For people who prioritize emotional and physical health over anything else, states that scored high in that rank such as Idaho and Iowa are probably more ideal. Likewise for those who really crave work place satisfaction,  states such as California, Colorado and Hawaii that ranked higher in that regard may be better choices.

Of course the data only gives a glimpse of states' happiness level, and there is a lot more than meets the eye. But it will definitely serve as one of practical references, giving people a sense of what is in store for them before deciding what states to relocate to.

About Author

Maggie Zou

Maggie Zou got a masters' degree in Math education and has been teaching Math and science in local school district for the past ten years . She also works as an interpreter on the side for the governments...
View all posts by Maggie Zou >

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