I have a dataframe, which structure looks like that:

[![df1](https://i.stack.imgur.com/YFlMd.png)](https://i.stack.imgur.com/YFlMd.png)

And in pandas I would like to have percentage change by month per every user, so I would like to receive result like below:

[![df2](https://i.stack.imgur.com/VexI4.png)](https://i.stack.imgur.com/VexI4.png)

I was trying to get this result by doing pivot:

```py
pivot_target1 = pd.pivot_table(target_group1, values=['volume_usd'], index=['user_id', 'date'],
                    aggfunc=pct_change())

```

I added here aggfunc as pct\_change as an example to show my logic but it doesn't work. Is there any function in pivot which I can use to have percentage change by month? Or maybe totally different solution?