The U.S. Department of Labor web site gives the following description of the Trade Adjustment Assistance (TAA) Program:
The Trade Adjustment Assistance (TAA) Program is a federal program established under the Trade Adjustment Assistance Reauthorization Act of 2015 that provides aid to workers who lose their jobs or whose hours of work and wages are reduced as a result of increased imports.
You can search for TAA cases on this page. The resulting data can then be downloaded into an Excel file for later analysis. The following Python code shows several examples of how this can be done.
The file Location_by_Date_search_d2012.xls is created by going to the search page, entering "1/1/2012" (without the quotes) for the "With determination date from" field, select "All" from the States select list, and hit the "Generate report" button. The resulting page should display the first 20 of 8334 records found. Click the "Export All to Excel" button, rename the resulting file to Location_by_Date_search_d2012.xls, and place it in the directory of this Jupyter notebook (taa.ipynb). The following Python code will then group the TAA petitions by company and sort by the number of certified petitions since 2012:
import pandas as pd
xx = pd.read_html("Location_by_Date_search_d2012.xls", header=0)
tt = xx[0]
tt['Impact_Date'] = pd.to_datetime(tt['Impact date'])
#print(type(tt))
#print(tt.info())
print(tt.shape)
cc = tt.loc[tt['Decision'] == 'Certified']
cc = cc.loc[pd.to_datetime(cc['Impact date']) > pd.to_datetime('1/1/2012')]
#print(cc.shape)
#print(cc.head())
gg = cc.groupby(['Company']).agg({'Decision Date':"count", 'Impact_Date':"max"})
gg = gg.reset_index(level=['Company'])
gg.columns = ['Company','Count','Last Date']
gg = gg.sort_values(by=['Count','Last Date'], ascending=False)
print(gg.head(50))
As can be seen, the top three companies by number of certified petitions since 2012 are Quest Diagnostics, International Business Machines Corporation (IBM), and Southern California Edison. The "Last Date" column lists the latest "Impact date" of all of the petitions. Note that there appears to be duplicate companies. For example, the above output lists the following three lines, all for IBM:
The problem is that these are three different spellings for the company.
The following Python code will do the same thing as the prior code except that it will group by the Company-Location combination, not just by the Company.
import pandas as pd
xx = pd.read_html("Location_by_Date_search_d2012.xls", header=0)
tt = xx[0]
tt['Impact_Date'] = pd.to_datetime(tt['Impact date'])
print(tt.shape)
cc = tt.loc[tt['Decision'] == 'Certified']
cc = cc.loc[pd.to_datetime(cc['Impact date']) > pd.to_datetime('1/1/2012')]
gg = cc.groupby(['Company','Location']).agg({'Decision Date':"count", 'Impact_Date':"max"})
gg = gg.reset_index(level=['Company','Location'])
gg.columns = ['Company','Location','Count','Last Date']
gg = gg.sort_values(by=['Count','Last Date'], ascending=False)
print(gg.head(50).to_string(index=''))
As can be seen, a number of companies have multiple certified petitions from multiple locations. For example, IBM has multiple petitions for Armonk NY, Poughkeepsie NY, Boulder CO, Essex Junction VT, Austin TX, and Rochester MN in the list above.
The following Python code will do the same thing as the prior code except that it will list entries for a single specified company. The first listing (by Company) above shows 30 petitions for Southern California Edison but the next listing (by Company and Location) lists no petitions for that company. The output from the following code reveals that this is because all of the locations are unique except for 2 petitions for Rosemead, CA. For that reason, they didn't show up in the second listing which lists all of the companies/locations with 3 or more petitions.
import pandas as pd
xx = pd.read_html("Location_by_Date_search_d2012.xls", header=0)
tt = xx[0]
tt['Impact_Date'] = pd.to_datetime(tt['Impact date'])
print(tt.shape)
cc = tt.loc[tt['Decision'] == 'Certified']
cc = cc.loc[pd.to_datetime(cc['Impact date']) > pd.to_datetime('1/1/2012')]
cc = cc.loc[cc['Company'] == 'Southern California Edison']
gg = cc.groupby(['Company','Location']).agg({'Decision Date':"count", 'Impact_Date':"max"})
gg = gg.reset_index(level=['Company','Location'])
gg.columns = ['Company','Location','Count','Last Date']
gg = gg.sort_values(by=['Count','Last Date'], ascending=False)
print(gg.head(50).to_string(index=''))
The file Location_by_Date_search_MA.xls is created by going to the search page, select the specified state (MA) from the States select list, and hit the "Generate report" button. The resulting page should display the first 20 of 2459 records found. Click the "Export All to Excel" button, rename the resulting file to Location_by_Date_search_MA.xls, and place it in the directory of this Jupyter notebook (taa.ipynb). The following Python code will then group the TAA petitions by company and sort by the number of certified petitions since 2012:
import pandas as pd
xx = pd.read_html("Location_by_Date_search_MA.xls", header=0)
tt = xx[0]
tt['Impact_Date'] = pd.to_datetime(tt['Impact date'])
print(tt.shape)
cc = tt.loc[tt['Decision'] == 'Certified']
cc = cc.loc[pd.to_datetime(cc['Impact date']) > pd.to_datetime('1/1/2012')]
gg = cc.groupby(['Company']).agg({'Decision Date':"count", 'Impact_Date':"max"})
gg = gg.reset_index(level=['Company'])
gg.columns = ['Company','Count','Last Date']
gg = gg.sort_values(by=['Count','Last Date'], ascending=False)
print(gg.head(50))
Note: The Jupyter Notebook from which this post is generated can be found at http://econdataus.com/taa1.ipynb.