In [10]:
import pandas as pd
df = pd.DataFrame({'Account':['Internal Revenue', 'Assets', 'External Rev', 'Rent'],
'Amount':[89989, 299499, 20992, 3200],
'Year_Month':['2021_01', '2021_02', '2021_03', '2021_04']})
In [11]:
df.head()
Out[11]:
In [12]:
df=df.pivot_table('Amount', ['Account'], 'Year_Month')
df=df.fillna(0)
df.head()
Out[12]:
In [ ]:
No comments:
Post a Comment