Have a dataframe, df:
import pandas as pd
import numpy as np
i = ['dog', 'cat', 'rabbit', 'elephant'] * 3
df = pd.DataFrame(np.random.randn(12, 2), index=i, columns=list('AB'))
...and a lookup dict for column B:
b_dict = {'elephant': 2.0, 'dog': 5.0}
How can column B of df be replaced for elephant and dog rows?
df['B'].update(b_dict)
gives:
AttributeError: 'dict' object has no attribute 'reindex_like'