emplo y ment and the labor force
play

Emplo y ment and the Labor Force AN ALYZIN G U S C E N SU S DATA - PowerPoint PPT Presentation

Emplo y ment and the Labor Force AN ALYZIN G U S C E N SU S DATA IN P YTH ON Lee Hachadoorian Asst . Professor of Instr u ction , Temple Uni v ersit y Emplo y ment Concepts Labor Force : People w ho are w orking or looking for w ork Unemplo y


  1. Emplo y ment and the Labor Force AN ALYZIN G U S C E N SU S DATA IN P YTH ON Lee Hachadoorian Asst . Professor of Instr u ction , Temple Uni v ersit y

  2. Emplo y ment Concepts Labor Force : People w ho are w orking or looking for w ork Unemplo y ed : People u nable to � nd w ork Unemplo y ment Rate : Unemployed / LaborForce Labor Force Participation Rate : LaborForce / WorkingAgePop ANALYZING US CENSUS DATA IN PYTHON

  3. Creating a Bar Plot year pct_unemployed 0 2011 10.264992 0 2012 9.373092 0 2013 8.435212 0 2014 7.226895 0 2015 6.297886 0 2016 5.750313 0 2017 5.281027 sns.barplot( x = "year", y = "pct_unemployed", color = "cornflowerblue", data = employment) ANALYZING US CENSUS DATA IN PYTHON

  4. pandas . melt print(hispanic_unemployment) year pct_hisp_male_25to54_unemp pct_hisp_female_25to54_unemp 0 2011 9.352638 11.426135 0 2012 8.062535 10.751855 0 2013 6.915451 9.524808 0 2014 5.724187 8.285590 0 2015 5.040303 7.070101 0 2016 4.568206 6.521980 0 2017 4.184646 5.706956 ANALYZING US CENSUS DATA IN PYTHON

  5. pandas . melt # Rename columns col_rename = {"pct_hisp_male_25to54_unemp": "male", "pct_hisp_female_25to54_unemp": "female"} hispanic_unemployment.rename(columns = col_rename, inplace = True) # Melt data frame tidy_unemp = hispanic_unemployment.melt( id_vars = "year", value_vars = ["male", "female"], var_name = "sex", value_name = "pct_unemployed") ANALYZING US CENSUS DATA IN PYTHON

  6. pandas . melt # Rename columns col_rename = {"pct_hisp_male_25to54_unemp": "male", "pct_hisp_female_25to54_unemp": "female"} hispanic_unemployment.rename(columns = col_rename, inplace = True) # Melt data frame tidy_unemp = hispanic_unemployment.melt( id_vars = "year", # value_vars = ["male", "female"], var_name = "sex", value_name = "pct_unemployed") ANALYZING US CENSUS DATA IN PYTHON

  7. pandas . melt year sex pct_unemployed 0 2011 male 9.352638 1 2012 male 8.062535 2 2013 male 6.915451 3 2014 male 5.724187 4 2015 male 5.040303 5 2016 male 4.568206 6 2017 male 4.184646 7 2011 female 11.426135 8 2012 female 10.751855 9 2013 female 9.524808 10 2014 female 8.285590 11 2015 female 7.070101 12 2016 female 6.521980 13 2017 female 5.706956 ANALYZING US CENSUS DATA IN PYTHON

  8. Creating a Gro u ped Bar Chart sns.barplot(x = "year", y = "pct_unemployed", hue = "sex", data = tidy_unemp) ANALYZING US CENSUS DATA IN PYTHON

  9. Let ' s practice ! AN ALYZIN G U S C E N SU S DATA IN P YTH ON

  10. Comm u ting Patterns AN ALYZIN G U S C E N SU S DATA IN P YTH ON Lee Hachadoorian Asst . Professor of Instr u ction , Temple Uni v ersit y

  11. Comm u ting Tables Comm u ting S u bjects Means of transportation ( car , p u blic transit , etc .) Tra v el time Time lea v ing for / arri v ing at w ork Comm u ting Geographies Residence : w here people sleep Workplace : w here people w ork ; can u se to determine w orkforce pop u lation for co u nt y, tract , etc . ANALYZING US CENSUS DATA IN PYTHON

  12. Congestion Pricing in Ne w York Cit y C u rrentl y being debated in NYC ( earl y 2019) Pre v io u s a � empt failed (2007) Concerns o v er cost for lo w- and middle - income ho u seholds 1 Photo b y Brian Je � er y Beggerl y ( CC BY 2.0) ANALYZING US CENSUS DATA IN PYTHON

  13. Table B 08519 : Means Of Transportation To Work B y Workers ' Earnings In The Past 12 Months ( In 2017 In � ation - Adj u sted Dollars ) For Workplace Geograph y Total $1 to $9,999 or loss $10,000 to $14,999 $15,000 to $24,999 $25,000 to $34,999 $35,000 to $49,999 $50,000 to $64,999 $65,000 to $74,999 $75,000 or more Car truck or van - drove alone <repeat income categories> Car truck or van - carpooled <repeat income categories> Public transportation (excluding taxicab) <repeat income categories> etc... ANALYZING US CENSUS DATA IN PYTHON

  14. API Response print(r.json()) [['B08519_011E', 'B08519_012E', 'B08519_013E', 'B08519_014E', 'B08519_015E', 'B08519_016E', 'B08519_017E', 'B08519_018E', 'B08519_020E', 'B08519_021E', ... 'B08519_061E', 'B08519_062E', 'B08519_063E', 'state', 'county'], ['10927', '9172', '19659', '22110', '32287', '32977', '15693', '106972', '3663', '2518', ... '7457', '2664', '20684', '36', '061']] ANALYZING US CENSUS DATA IN PYTHON

  15. Reshaping the Data # Read data row into list data_row = r.json()[1][:-2] # Break data row into list of lists iter_len = 8 data = [data_row[i:i+iter_len] for i in range(0, len(data_row), iter_len)] print(data) [['10927', '9172', '19659', '22110', '32287', '32977', '15693', '106972'], ['3663', '2518', '5484', '5625', '8028', '7990', '3369', '22958'], ['139358', '97178', '200514', '184510', '255491', '240973', '116673', '700808'], ['16743', '9117', '15900', '13710', '17442', '20206', '10370', '85879'], ...] ANALYZING US CENSUS DATA IN PYTHON

  16. Constr u cting the Data Frame # Define row names and column names modes = ["drove_alone", "carpooled", "public", "walked", "taxi", "worked_at_home"] incomes = ["0k", "10k", "15k", "25k", "35k", "50k", "65k", "75k"] # Create data frame manhattan = pd.DataFrame(data=data, index=modes, columns=incomes) manhattan = manhattan.astype(int) ANALYZING US CENSUS DATA IN PYTHON

  17. Constr u cting the Data Frame print(manhattan) 0k 10k 15k ... 50k 65k 75k drove_alone 10716 8965 19294 ... 31502 15519 104078 carpooled 3740 2451 5852 ... 7994 3438 22625 public 140957 99474 197241 ... 235158 111959 654800 walked 16795 9045 15451 ... 20704 10663 83681 taxi 3201 2209 4515 ... 6551 3029 35572 worked_at_home 6854 3885 5489 ... 7776 2809 19598 [6 rows x 8 columns] ANALYZING US CENSUS DATA IN PYTHON

  18. Constr u cting the Heatmap # Create heatmap of commuters by mode by income sns.heatmap(manhattan, annot=manhattan // 1000, fmt="d", cmap="YlGnBu") ANALYZING US CENSUS DATA IN PYTHON

  19. Let ' s practice ! AN ALYZIN G U S C E N SU S DATA IN P YTH ON

  20. Migration AN ALYZIN G U S C E N SU S DATA IN P YTH ON Lee Hachadoorian Asst . Professor of Instr u ction , Temple Uni v ersit y

  21. ACS Mobilit y Tables - Common Col u mns Table names " B 07xxx", generall y w ith col u mns like these : Total li v ing in area ( c u rrent residence ) Same ho u se 1 y ear ago ( i . e . did not mo v e ) Mo v ed w ithin co u nt y Mo v ed from a di � erent co u nt y, same state Mo v ed from a di � erent state Mo v ed from abroad ANALYZING US CENSUS DATA IN PYTHON

  22. ACS Mobilit y Tables - Additional Feat u res Mobilit y crossed w ith : Age Ed u cational A � ainment Income Citi z enship Stat u s etc . Tables based on residence 1 y ear ago P u erto Rico ( e . g . B 07001 PR : Geographical Mobilit y in the Past Year b y Age for C u rrent Residence in P u erto Rico ) ANALYZING US CENSUS DATA IN PYTHON

  23. Going to California print(to_cali_2016) move_status persons 0 same_house 32740745 1 within_county 3581323 2 within_state 1062756 3 different_state 501384 4 abroad 305148 sns.barplot(x = "move_status", y = "persons", data = to_cali_2016) Data from ACS 2016 Table B 07001: ANALYZING US CENSUS DATA IN PYTHON

  24. Migration Flo w s ANALYZING US CENSUS DATA IN PYTHON

  25. State - to - State Migration Matri x print(state_to_state.head()) Alabama Alaska Arizona ... Wisconsin Wyoming Puerto Rico Alabama NaN 576.0 1022.0 ... 874.0 539.0 335.0 Alaska 423.0 NaN 1176.0 ... 260.0 291.0 848.0 Arizona 894.0 1946.0 NaN ... 6736.0 925.0 1462.0 Arkansas 2057.0 103.0 836.0 ... 539.0 178.0 857.0 California 3045.0 4206.0 33757.0 ... 7354.0 2674.0 1102.0 ANALYZING US CENSUS DATA IN PYTHON

  26. State - to - State Migration Heatmap sns.heatmap(state_to_state, cmap="YlGnBu") ANALYZING US CENSUS DATA IN PYTHON

  27. Let ' s practice ! AN ALYZIN G U S C E N SU S DATA IN P YTH ON

  28. Is the Rent Too Damn High ? AN ALYZIN G U S C E N SU S DATA IN P YTH ON Lee Hachadoorian Asst . Professor of Instr u ction , Temple Uni v ersit y

  29. Definitions Di � erent w a y s of calc u lating rent : Contract Rent : Rent paid on a lease Gross Rent : Rent pl u s u tilities ; u tilities ma y be incl u ded in contract rent on some leases , paid separatel y b y the renter on other leases Rent b u rden : Rent B u rden : Pa y ing 30% or more of ho u sehold income in rent Se v ere Rent B u rden : Pa y ing 50% or more of ho u sehold income in rent ANALYZING US CENSUS DATA IN PYTHON

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend