Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical Data Science Cookbook, Second Edition

You're reading from   Practical Data Science Cookbook, Second Edition Data pre-processing, analysis and visualization using R and Python

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher Packt
ISBN-13 9781787129627
Length 434 pages
Edition 2nd Edition
Languages
Arrow right icon
Authors (5):
Arrow left icon
Anthony Ojeda Anthony Ojeda
Author Profile Icon Anthony Ojeda
Anthony Ojeda
Prabhanjan Narayanachar Tattar Prabhanjan Narayanachar Tattar
Author Profile Icon Prabhanjan Narayanachar Tattar
Prabhanjan Narayanachar Tattar
ABHIJIT DASGUPTA ABHIJIT DASGUPTA
Author Profile Icon ABHIJIT DASGUPTA
ABHIJIT DASGUPTA
Sean P Murphy Sean P Murphy
Author Profile Icon Sean P Murphy
Sean P Murphy
Bhushan Purushottam Joshi Bhushan Purushottam Joshi
Author Profile Icon Bhushan Purushottam Joshi
Bhushan Purushottam Joshi
+1 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Preparing Your Data Science Environment 2. Driving Visual Analysis with Automobile Data with R FREE CHAPTER 3. Creating Application-Oriented Analyses Using Tax Data and Python 4. Modeling Stock Market Data 5. Visually Exploring Employment Data 6. Driving Visual Analyses with Automobile Data 7. Working with Social Graphs 8. Recommending Movies at Scale (Python) 9. Harvesting and Geolocating Twitter Data (Python) 10. Forecasting New Zealand Overseas Visitors 11. German Credit Data Analysis

Extracting state- and county-level wage and employment information


So far, we worked to get the data into shape for analysis. We'll now start with looking at the geographical distribution of the average annual pay per state and per county.

Getting ready

If you have thoroughly followed the recipes in this chapter until now, you will have the data in a form from where you can extract information at different levels. We're good to go!

How to do it...

We will first extract data from ann2014full at the state-level. We need to perform the following steps:

  1. We look at the aggregate state-level data. A peek at agglevel tells us that the code for the level of data that we want is 50. Also, we only want to look at the average annual pay (avg_annual_pay) and the average annual employment level (annual_avg_emplvl), and not the other variables:
d.state <- filter(ann2014full, agglvl_code==50)
d.state <- select(d.state, state, avg_annual_pay, annual_avg_emplvl)
  1. We create two new variables, wage and empquantile...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image