I want to remap values in several columns of my DataFrame: from [site1] to [site5].
Here is my dictionary:
new_dict
{'accounts.google.com': 5,
'apis.google.com': 7,
'football.kulichki.ru': 9,
'geo.mozilla.org': 3,
'google.com': 4,
'mail.google.com': 6,
'meduza.io': 10,
'oracle.com': 2,
'plus.google.com': 8,
'vk.com': 1,
'yandex.ru': 11}
site1 site2 site3 site4 site5 user
0 vk.com oracle.com oracle.com geo.mozilla.org oracle.com 1
1 vk.com google.com google.com google.com 0 2
Is there a way to remap these columns at the same time? I'm trying this approach, but it doesn't work in any way...
df_train['site%d' %(range(1,11))].replace(new_dict)