Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. City Country
  2. -----------------
  3. NY US
  4. LA US
  5. Paris France
  6. Roma Italy
  7.  
  8. Place Score ID_ref
  9. ----------------------------------
  10. Paris +1 0010
  11. US +5 1000
  12. Italy -8 3020
  13.  
  14. Place Score ID_ref
  15. ------------------------------------
  16. Paris +1 0010
  17. France +1 0010
  18. US +5 1000
  19. LA +5 1000
  20. NY +5 1000
  21. Italy -8 3020
  22. Roma -8 3020
  23.  
  24. pd.concat(
  25. [df_p.set_index(df_p['Country']).rename_axis('Place', axis=0).stack().reset_index().merge(df_2),
  26. df_p.set_index(df_p['City']).rename_axis('Place', axis=0).stack().reset_index().merge(df_2)],
  27. ignore_index=True).drop_duplicates()[['Place','Score','ID_ref']]
  28.  
  29. Place Score ID_ref
  30. 0 US 5 1000
  31. 1 US 5 1000
  32. 2 US 5 1000
  33. 4 Italy -8 3020
  34. 5 Italy -8 3020
  35. 6 Paris 1 10
  36. 7 Paris 1 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement