I want to compare the following dictionary key:
{('F123', 1): 'R'}
To the index of the following dataframe ('F123', 1):
Connector Pin Connector Pin Adj. Color
F123 1 F123 1 [2, 6, 7] NaN
If the dictionary key is equal to the dataframe index ('F123', 1) I want copy the dictionary value ('R') into the color column associated with the matching index. Both the dictionary and dataframe have a number of rows but for explanations sake I included only one of each. Speed doesn't matter as the data set is not big enough to matter.
if(df.index == dict.key()):
df['Color'] = dict.value()
I am struggling syntactically on how to approach this problem.
update: I attempted this below (which I know is wrong). Still trying to nail down how to test all dict. keys one by one without hardcoding it in.
s = df.iterrows(pd.Series(dict.keys()))
df['Color'] = s