Guest User

Untitled

a guest
Aug 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. ## Crosswalk
  2. import pandas as pd
  3.  
  4. ## Read in the ScorecardDepartments
  5. ## Set index to False
  6. ambDF = pd.read_excel('ScorecardDepartments.xlsx','Departments',index=False)
  7.  
  8. crossDF = pd.read_excel('Crosswalk.xlsx',index=False)
  9.  
  10. ## Only select rows that have departments in the Scorecard
  11. ambDF = ambDF.loc[ambDF['Include in Scorecard'] == 'Y']
  12.  
  13. ## Set Column Dept to int
  14. pd.to_numeric(ambDF['Dept'])
  15.  
  16. ambDF = ambDF.sort_values(by=['Dept'])
  17. crossDF = crossDF.sort_values(by=['Dept'])
  18. ## Change Crosswalk Dept column to a list
  19. ## to use in comparison
  20. Departments = crossDF['Dept'].tolist()
  21.  
  22. ## Create a new dataframe with just the
  23. ## the dept information
  24. changeRows = ambDF.loc[ambDF['Dept'].isin(Departments)]
Add Comment
Please, Sign In to add comment