Happiest States in America-Web Scraping

Posted on Apr 17, 2017


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 Wallethub.com 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:

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.


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:

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 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws 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 Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R 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 Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp