I have an array called arr1
arr1
Out[23]:
[('001',
'249',
'580',
'E930'),
('001',
'270',
'290',
'780'),
('030',
'110',
'789',
'990',
'996',
'E8779',
'E9349',
'V10',
'V85'),
('030',
'070',
'249',
'270',
'360',
'400',
'450',
'490',
'V10',
'V40'),
('400', '580', '990', '916'),
('030',
'270',
'600',
'725',
'780',
'990',
'996',
'V10'),
('110',
'200',
'249',
'340',
'400',
'410',
'420',
'510'),
('400', '430'),
('210', '400', '420', '450', '720', 'V10'),
('070', '280', '286', '290', '300', '450', '570')]
and I have a dataframe called df_map
df_map
Out[24]:
Old New
1 001 A91
2 780 B63
3 E8779 C72
4 V85 D02
5 450 E82
... ...
999 070 F28
I want to swap Old values in the array with the new values in the dataframe
Here is my code
for x in arr1:
for y in x:
y=df_map[(df_map["Old"]==y)]["New"]
but when I check arr1 values they still the orginal
I want arr1 values to be the new values in df_maps
arr1.