Hi Shir, Thanks for the great tips and tricks.
I just wrote the code to build the initial dataset for anyone who wants to follow the codes step by step on their own. :)
import pandas as pd
df = pd.DataFrame([[‘Chandler Bing’,’party’,’2017–08–04 08:00:00',51],
[‘Chandler Bing’,’party’,’2017–08–04 13:00:00',60],
[‘Chandler Bing’,’party’,’2017–08–04 15:00:00',59],
[‘Harry Kane’,’football’,’2017–08–04 13:00:00',80],
[‘Harry Kane’,’party’,’2017–08–04 11:00:00',90],
[‘Harry Kane’,’party’,’2017–08–04 07:00:00',68],
[‘John Doe’,’beach’,’2017–08–04 07:00:00',63],
[‘John Doe’,’beach’,’2017–08–04 12:00:00',61],
[‘John Doe’,’beach’,’2017–08–04 14:00:00',65],
[‘Joey Tribbiani’,’party’,’2017–08–04 09:00:00',54],
[‘Joey Tribbiani’,’party’,’2017–08–04 10:00:00',67],
[‘Joey Tribbiani’,’football’,’2017–08–04 08:00:00',84],
[‘Monica Geller’,’travel’,’2017–08–04 07:00:00',90],
[‘Monica Geller’,’travel’,’2017–08–04 08:00:00',96],
[‘Monica Geller’,’travel’,’2017–08–04 09:00:00',74],
[‘Phoebe Buffey’,’travel’,’2017–08–04 10:00:00',52],
[‘Phoebe Buffey’,’travel’,’2017–08–04 12:00:00',84],
[‘Phoebe Buffey’,’football’,’2017–08–04 15:00:00',58],
[‘Ross Geller’,’party’,’2017–08–04 09:00:00',96],
[‘Ross Geller’,’party’,’2017–08–04 11:00:00',81],
[‘Ross Geller’,’travel’,’2017–08–04 14:00:00',60]],
columns=[‘name’,’activity’,’timestamp’,’money_spent’])
df[‘timestamp’] = pd.to_datetime(df[‘timestamp’])
