I've a question about python's dataframes.
I've a dataframe with data from xlsx like :
years = np.arange(2000, 2010)
engine = ['A', 'B', 'C', 'D']
df = pd.DataFrame({
'Engine': np.repeat(['A', 'B', 'C', 'D'], 10),
'Year': np.tile(np.arange(2000, 2010), 4),
'Energy': np.random.randint(10, 100, 40)
})
And I've a dict like :
Max = {'A' : 100, 'B' : 200, 'C' : 300, 'D' : 400}
And I'd like to add to my df a col named 'Max' and this col will match the dict key with the Engine name and add the dict value to the Max col.
Someone can help me ?
Thx a lot