'Finding daily balance using pandas?

I have a data frame like this...

Customer Date Balance
Adam 01/01/2022 10
Adam 01/01/2022 20
Adam 03/01/2022 30
Molly 01/01/2022 40
Molly 01/01/2022 50
Molly 03/01/2022 60

I want to find daily day-end balance for each customer. I tried groupby with resample method but couldn't do any. For both customer 2nd of January is missing, so my function should create a row for 2nd January and populat it with previous day end balance. My output should be like this-

Customer Date Balance
Adam 01/01/2022 20
Adam 02/01/2022 20
Adam 03/01/2022 30
Molly 01/01/2022 50
Molly 02/01/2022 50
Molly 03/01/2022 60


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source