The Most Borrowed Genre
Data questions · Advanced · about 10 min
The library keeps two files. books.csv has each book's id, title and genre. loans.csv has one row per loan: the id of the book lent and the date. Set answer to the genre with the most loans, written exactly as in books.csv.
Example
The first lines of books.csv:
book_id,title,genre B01,The Silent Forest,Fiction B02,The Lost Key,Fiction
and of loans.csv:
book_id,date B05,2025-09-01 B01,2025-09-01
books.csv · 10 rows
| book_id | title | genre |
|---|---|---|
| B01 | The Silent Forest | Fiction |
| B02 | The Lost Key | Fiction |
| B03 | The Clockmaker | Fiction |
| B04 | Under the Bridge | Fiction |
| B05 | Space for Beginners | Science |
| B06 | Simple Machines | Science |
| B07 | Volcanoes | Science |
| B08 | Ancient Egypt | History |
First 8 of 10 rows.
loans.csv · 25 rows
| book_id | date |
|---|---|
| B05 | 2025-09-01 |
| B01 | 2025-09-01 |
| B07 | 2025-09-02 |
| B06 | 2025-09-02 |
| B10 | 2025-09-03 |
| B05 | 2025-09-03 |
| B08 | 2025-09-04 |
| B02 | 2025-09-04 |
First 8 of 25 rows.
import pandas as pd
books = pd.read_csv("books.csv")
loans = pd.read_csv("loans.csv")
answer = None
The solution opens after your first Check.