I have a data-frame with duplicated accounts divided into different periods:
df1 = pd.DataFrame({
'Account': ['OCOA/5000000200','OCOA/5000000200','OCOA/5000001200','OCOA/5000101000','OCOA/5000101000','OCOA/5000120000'],
'Amount': [346233.58, 24571.80, 2970.53, 5243.00, 4469.02, 5951.07],
'sheet_name': ['YE','Q1','Q3', 'YE', 'Q4', 'Q2']
[![enter image description here][1]][1]
I would like to update another data-frame with unique accounts with the amounts divided per period where the column name corresponds to sheet_name from the first data-frame. So, the results would look like: [![enter image description here][2]][2]
Another data-frame is not a pivot but looks like this:
df2 = pd.DataFrame({
'Account': ['OCOA/5000000200','OCOA/5000001200','OCOA/5000101000','OCOA/5000120000'],
'YE': [0,0,0,0],
'Q1': [0,0,0,0],
'Q2': [0,0,0,0],
'Q3': [0,0,0,0],
'Q4': [0,0,0,0],
}) How can I do this? [1]: https://i.stack.imgur.com/D335b.png [2]: https://i.stack.imgur.com/Qe4Gm.png