Skip to content

Commit

Permalink
added function load_MSA_emp_byInd to DataLoader that uses CBP API to …
Browse files Browse the repository at this point in the history
…get employment by metro area by NAICS code; will be useful for benchmark indicators (we can choose to calculate every indicator that uses NAICS for diferent cities #5) and the rankings in #4
  • Loading branch information
crisjf committed May 22, 2020
1 parent 9373bd5 commit 1e676b8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion indicator_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import requests
import os
from bs4 import BeautifulSoup
from APICalls import ACSCall,patentsViewDownload,load_zipped_excel
from APICalls import ACSCall,patentsViewDownload,load_zipped_excel,CBPCall
from download_shapeData import SHAPES_PATH
from toolbox import Handler, Indicator
import pandas as pd
Expand Down Expand Up @@ -246,6 +246,8 @@ def __init__(self,occLevel=3,saveData=True,data_path='tables/innovation_data',qu
self.RnD = None
self.IO_data = None

self.emp_msa_ind = None

self.skills = None
self.knowledge = None
self.msa_skills = None
Expand Down Expand Up @@ -469,6 +471,15 @@ def load_MSA_data(self):
emp = emp[emp['GEOID'].isin(set(msas['GEOID']))]
self.emp_msa = emp

def load_MSA_emp_byInd(self):
'''
Loads employment by industry for each MSA.
'''
self.load_MSA_data()
df = CBPCall(NAICS_lvl=3).rename(columns={'metropolitan statistical area/micropolitan statistical area':'MSA'})
df = df[df['MSA'].isin(set(self.pop_msa['GEOID']))]
self.emp_msa_ind = df


def load_ZIP_data_byInd(self,year = '2016'):

Expand Down

0 comments on commit 1e676b8

Please sign in to comment.