Skip to main content

Session Data Analysis

HardPremium

You are given a dataset with one row per user session. The table contains the following columns:

  • country: The country of the user.
  • session_time: The length of the session in seconds.

Download the dataset here!

Practice this interview question in your preferred .ipynb environment. Psst... Google Colab is a free, online .ipynb environment that is easy to get up and running!

Part 1: Calculate avg. session time

Calculate the average session time for sessions that are longer than 3 minutes (180 seconds).

Part 2: Visualize data

Create a histogram of session lengths using bins of 5 minutes (300 seconds). How would you prepare the data for this histogram?

Finally, plot the histogram!

Part 3: Find similar countries

“Similar countries” are countries that have a number of sessions within 10% of each other. How would you identify such pairs of countries? The output should be a table with two columns:

  • country_a: The first country in the pair.
  • country_b: The second country in the pair.