November 2018
Intermediate to advanced
322 pages
7h 54m
English
Fields visitorid and itemid are already numeric, but we still need to convert the events into numeric values.
events.event.replace(to_replace=dict(view=1, addtocart=2, transaction=3), inplace=True)
events.drop(['transactionid'],axis=1,inplace=True)events.drop(['timestamp'],axis=1,inplace=True)
events = events.reindex(np.random.permutation(events.index))
The dataset can also be shuffled with the following command:
events = events.sample(frac=1).reset_index(drop=True)
Read now
Unlock full access