AnalystPath

Format the Conference Badge Label

PandasEasyJunior level~10 min

Problem

You are given a DataFrame `attendee` with columns `attendee_id`, `full_name`, and `department`.

Build a badge label for every attendee: the attendee's full name followed by the first letter of their `department` in parentheses, for example 'Harper(M)' for someone in Marketing. The case of that first letter is kept as-is.

Return two columns, `attendee_id` and `label`, ordered by `attendee_id` from highest to lowest.

Input data

Example rows — the live problem includes the full dataset.

attendee
attendee_idfull_namedepartment
1HarperSales
3QuinnAnalytics
2ReyesProduct
4SotoDesign
6VanceEngineering

Expected output

Your answer should return 6 rows with the columns attendee_id, label.

Starter code (Pandas (Python))

import pandas as pd

def format_conference_badge_label(attendee) -> 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