Listening minutes per listener

aggregations

Listening minutes per listener

Pandora Pandas Interview Question

Pandora bills advertisers on hours delivered, so the first number any campaign report needs is how long each listener actually spent in the app. The log records each play in milliseconds, which is useful to a machine and to nobody else.

Using the plays DataFrame, find each listener_id and their total listening time in minutes as minutes, rounded to 1 decimal place. Sort by minutes, highest first. Assign the answer to result.

Asked of

  • Data Analyst
  • Business Analyst
  • BI Analyst
  • Product Analyst
  • Analytics Engineer
  • Data Scientist

playsDataFrame30 rows

Column NameType
play_idint64
listener_idstr
track_idstr
played_atstr
ms_playedint64

playsExample Input

play_idlistener_idtrack_idplayed_atms_played
5001L01T1002024-03-04 08:02:00210000
5002L01T1042024-03-04 08:06:00185000
5003L01T1002024-03-04 08:10:00198000
5004L01T1122024-03-04 09:15:00240000
5005L01T1042024-03-04 09:21:00172000
5006L01T1002024-03-04 18:40:00205000
5007L01T1182024-03-04 18:44:00160000
5008L01T1122024-03-04 18:49:00233000
5026L04T1002024-03-04 11:00:00204000
5027L04T1002024-03-04 11:05:00201000
5028L04T1042024-03-04 15:45:00178000
5029L04T1182024-03-04 15:52:00162000
5030L04T1212024-03-04 15:58:00249000

Example Output

listener_idminutes
L0126.7
L0416.6

Explanation

L01 listened for 1,603,000 milliseconds across eight plays in the example, which is 26.7 minutes. L04 managed 16.6 across five. The longest listener comes first.

The example above is a small slice of the data. Your code runs against the full DataFrames.