Guest User

Untitled

a guest
May 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. country | year | supporting_nation | eco_sup | mil_sup
  2. ------------------------------------------------------------------
  3. Fake 1984 US 1 1
  4. Fake 1984 SU 0 1
  5.  
  6. country | year | US_SUP | US_eco_sup | US_mil_sup | SU_SUP | SU_eco_sup | SU_mil_sup |
  7. ------------------------------------------------------------------------------------------
  8. Fake 1984 1 1 1 1 1 1
  9. Fake 1985 1 1 1 1 1 1
  10. florp 1984 0 0 0 1 1 1
  11. florp 1985 0 0 0 1 1 1
  12.  
  13. def get_values(x):
  14. cols = ['eco_sup', 'mil_sup']
  15. nation = ''
  16. if x['Soviet Union'] == 1:
  17. nation = 'SU_'
  18. if x['United States'] == 1:
  19. nation = 'US_'
  20.  
  21. support_vars = x[['eco_sup', 'mil_sup']]
  22. # Since each line contains only one measure of support I can
  23. # automatically assume that the support_vars are from
  24. # the correct nation
  25. support_cols = [nation + x for x in cols]
  26. x[support_cols] = support_vars
Add Comment
Please, Sign In to add comment