Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- country | year | supporting_nation | eco_sup | mil_sup
- ------------------------------------------------------------------
- Fake 1984 US 1 1
- Fake 1984 SU 0 1
- country | year | US_SUP | US_eco_sup | US_mil_sup | SU_SUP | SU_eco_sup | SU_mil_sup |
- ------------------------------------------------------------------------------------------
- Fake 1984 1 1 1 1 1 1
- Fake 1985 1 1 1 1 1 1
- florp 1984 0 0 0 1 1 1
- florp 1985 0 0 0 1 1 1
- def get_values(x):
- cols = ['eco_sup', 'mil_sup']
- nation = ''
- if x['Soviet Union'] == 1:
- nation = 'SU_'
- if x['United States'] == 1:
- nation = 'US_'
- support_vars = x[['eco_sup', 'mil_sup']]
- # Since each line contains only one measure of support I can
- # automatically assume that the support_vars are from
- # the correct nation
- support_cols = [nation + x for x in cols]
- x[support_cols] = support_vars
Add Comment
Please, Sign In to add comment