AnalystPath

Middle-Tier Workshop Topics

PandasMediumMid level~10 min

Problem

Two DataFrames describe sign-ups for workshop topics.

`attendee` (`attendee.csv`) has columns `person_id`, `fullname`, `topic` — one row per person, recording which workshop `topic` they signed up for.

`topic` (`topic.csv`) has columns `topic_id`, `topic` — the catalogue of topics.

Find the workshop topics that are **neither the least popular nor the most popular**: every topic whose sign-up count is **strictly greater than the smallest** topic's count **and strictly less than the largest** topic's count. Return a DataFrame with the single column `topic`. Rows may be in any order.

**Example**

If `Welding` has 3 sign-ups (most), `Origami` has 1 (fewest), and `Pottery` has 2 (strictly between), only `Pottery` is returned.

Input data

Example rows — the live problem includes the full dataset.

attendee
person_idfullnametopic
1AdaWelding
2BoWelding
3CyWelding
4DiPottery
5EdPottery
topic
topic_idtopic
1Welding
2Pottery
3Origami

Expected output

Your answer should return 1 row with the columns topic.

Starter code (Pandas (Python))

import pandas as pd

def middle_tier_topics(attendee: pd.DataFrame, topic: pd.DataFrame) -> pd.DataFrame:
    # Your code here
    return attendee

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