AnalystPath

Books Missing a Record

PandasEasyJunior level~10 min

Problem

You are given two DataFrames.

`titles` — one row per titled book:

| Column | Type |
|---------|------|
| book_id | int |
| title | str |

`pricing` — one row per priced book:

| Column | Type |
|---------|------|
| book_id | int |
| price | int |

`book_id` is unique in each table.

A book has **incomplete information** when it is missing from one of the two tables: it has a title but no price, or a price but no title.

Return a DataFrame with the `book_id` of every book that has incomplete information, ordered by `book_id` ascending.

Input data

Example rows — the live problem includes the full dataset.

titles
book_idtitle
1Dawn Tide
2Iron Vale
3Quiet Hours
pricing
book_idprice
230
445

Expected output

Your answer should return 3 rows with the columns book_id.

Starter code (Pandas (Python))

import pandas as pd

def books_missing_a_record(titles: pd.DataFrame, pricing: pd.DataFrame) -> pd.DataFrame:
    # Your code here
    return titles

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