I attempting to replace values from a column in one dataframe based on values in another dataframe.
This is the first three rows of the column to be amended in my df:
This is the other dataframe called 'areas'. This has the info required to update my df.
In this example, the desired output would happen by chance to look just like the 'county' column of the areas df. But this mapping procedure would have to be carried out on over 40,000 columns and it will not follow this pattern as the values in my df comprise of random values of the areas df.
The code I have written so far, is the creation of a dictionary with the key being county:
districts = dict(zip(areas['County'], areas['CC']))
{'Aveiro': 'Águeda', 'Beja': 'Aljustrel', 'Braga': 'Vizela'}
I may be on the right track here, thing is I haven't been able to work out how to have the values taken from both the 'CC' and 'FR' columns. If I'm able to have a dictionary with the key being the county and values, the CC AND FR of the county, I will easily be able to map the DF. Of course I am very much open to other solutions!
Desired output: