AnalystPath

Frequent Host-Guest Pairs

PandasEasyJunior level~10 min

Problem

You are given a DataFrame `recording_session` with columns `host_id`, `guest_id`, and `session_no`. Each row records one recording session between a host and a guest.

Return every `(host_id, guest_id)` pair that appears in **three or more** sessions. Output the two columns `host_id` and `guest_id`.

Input data

Example rows — the live problem includes the full dataset.

recording_session
host_idguest_idsession_no
110
111
112
123
124

Expected output

Your answer should return 1 row with the columns host_id, guest_id.

Starter code (Pandas (Python))

import pandas as pd

def frequent_host_guest_pairs(recording_session) -> pd.DataFrame:
    # Your code here
    return recording_session

Solve this Pandas question free

Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related Pandas questions