Editor

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_idtitlegenre
B01The Silent ForestFiction
B02The Lost KeyFiction
B03The ClockmakerFiction
B04Under the BridgeFiction
B05Space for BeginnersScience
B06Simple MachinesScience
B07VolcanoesScience
B08Ancient EgyptHistory

First 8 of 10 rows.

loans.csv · 25 rows
book_iddate
B052025-09-01
B012025-09-01
B072025-09-02
B062025-09-02
B102025-09-03
B052025-09-03
B082025-09-04
B022025-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.