Guest User

Untitled

a guest
Apr 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. |code| |name|
  2. 001 Australia
  3. 002 London
  4. ...
  5. 001 <blank>
  6.  
  7. code_names = [ "",
  8. 'Economic management',
  9. 'Public sector governance',
  10. 'Rule of law',
  11. 'Financial and private sector development',
  12. 'Trade and integration',
  13. 'Social protection and risk management',
  14. 'Social dev/gender/inclusion',
  15. 'Human development',
  16. 'Urban development',
  17. 'Rural development',
  18. 'Environment and natural resources management'
  19. ]
  20.  
  21. df_copy = df_.copy()
  22.  
  23. # Looks through each code name, and if it is empty, stores the proper name in its place
  24. for x in range(len(df_copy.mjtheme_namecode)):
  25. for y in range(len(df_copy.mjtheme_namecode[x])):
  26. if(df_copy.mjtheme_namecode[x][y]['name'] == ""):
  27. df_copy.mjtheme_namecode[x][y]['name'] = code_names[int(df_copy.mjtheme_namecode[x][y]['code'])]
  28.  
  29. limit = 25
  30. counter = 0
  31.  
  32. for x in range(len(df_copy.mjtheme_namecode)):
  33. for y in range(len(df_copy.mjtheme_namecode[x])):
  34. print(df_copy.mjtheme_namecode[x][y])
  35. counter += 1
  36. if(counter >= limit):
  37. break
Add Comment
Please, Sign In to add comment