AnalystPath

Library Entries Without a Checkout

PandasEasyJunior level~10 min

Problem

You are given two DataFrames:
- `libraryentries` with `entry_id`, `member_id` (one row per visit a member logged)
- `checkouts` with `checkout_id`, `entry_id`, `item_count` (a checkout always links back to an entry)

An entry is "empty" when its `entry_id` never appears in `checkouts` (the member logged a visit but checked nothing out). For each member who has at least one empty entry, count how many empty entries they have.

Return columns `member_id` and `empty_entries`. Members whose every entry has a checkout are omitted.

Input data

Example rows — the live problem includes the full dataset.

libraryentries
entry_idmember_id
123
29
430
554
696
checkouts
checkout_identry_iditem_count
252
351
954
1211
1323

Expected output

Your answer should return 3 rows with the columns member_id, empty_entries.

Starter code (Pandas (Python))

import pandas as pd

def library_entries_without_a_checkout(libraryentries, checkouts) -> pd.DataFrame:
    # Your code here
    return libraryentries

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