Data Web Scraping Happiest States in America
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 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.