AnalystPath

Subscriber Count per Channel

PandasEasyJunior level~10 min

Problem

You are given a DataFrame `subscription` with columns `channel_id` and `subscriber_id`.

For each channel, return how many subscribers it has. Order the result by `channel_id`. Output columns: `channel_id`, `subscriber_count`.

Input data

Example rows — the live problem includes the full dataset.

subscription
channel_idsubscriber_id
110
111
112
210
213

Expected output

Your answer should return 2 rows with the columns channel_id, subscriber_count.

Starter code (Pandas (Python))

import pandas as pd

def subscriber_count_per_channel(subscription) -> pd.DataFrame:
    # Your code here
    return subscription

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