Section 2: Customer Activity Analysis

In this lesson, the customers activity data throughout the month will be analyzed.

Users activity

As mentioned in the previous lesson, the user can perform three actions that get recorded in the dataset.

  • view: The user can view an item.

  • cart: The user can add the item to the cart.

  • purchase: The user can purchase the item.

Analyzing the view and purchasing actions of the user across the different timelines in a month can provide very important information as to at what time most of the users visit the site. When such times are known, resources can be allocated according to that information to optimize performance.

For example, if we know that a significant amount of users visit the site on Sunday just to view the products, resources from other components can be transferred to viewing components to enhance the user experience. Similarly, the same approach can be used on other components if we know at what times certain, user activity is preferred.

Let’s apply this approach to our data and review what analysis can be drawn from it.


Before we move to extract information, some preprocessing needs to be done on our initial DataFrame. The time values are separated from the event_time column and are made into separate columns. The day, week_day, and hour are computed for each event_time value.

Get hands-on with 1000+ tech skills courses.