Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- City Country
- -----------------
- NY US
- LA US
- Paris France
- Roma Italy
- Place Score ID_ref
- ----------------------------------
- Paris +1 0010
- US +5 1000
- Italy -8 3020
- Place Score ID_ref
- ------------------------------------
- Paris +1 0010
- France +1 0010
- US +5 1000
- LA +5 1000
- NY +5 1000
- Italy -8 3020
- Roma -8 3020
- pd.concat(
- [df_p.set_index(df_p['Country']).rename_axis('Place', axis=0).stack().reset_index().merge(df_2),
- df_p.set_index(df_p['City']).rename_axis('Place', axis=0).stack().reset_index().merge(df_2)],
- ignore_index=True).drop_duplicates()[['Place','Score','ID_ref']]
- Place Score ID_ref
- 0 US 5 1000
- 1 US 5 1000
- 2 US 5 1000
- 4 Italy -8 3020
- 5 Italy -8 3020
- 6 Paris 1 10
- 7 Paris 1 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement