Hanukkah of Data 5784 - Day 5 The Cat Lady
The Task
We’re given the following identifying clues:
- The person is a woman (can be ignored!)
- The person wore a Noah’s Market sweatshirt (can be ignored!)
- The person has 10 or 11 old cats
The Solution
I followed a “red herring” for a while, because I thought a Noah’s Jersey product might be the same as a “sweat shirt”, but that “clue” is irrelevant. I also mistakenly went down the “Adult Cat Food” trail for a while before I noticed they also have "Senior Cat Food"! I eventually just looked for someone with an order item containing at least 10 units of Senior Cat Food.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import pandas as pd def solve(): customers = pd.read_csv('noahs-customers.csv') orders = pd.read_csv('noahs-orders.csv') order_items = pd.read_csv('noahs-orders_items.csv') products = pd.read_csv('noahs-products.csv') data = customers.merge(orders).merge(order_items).merge(products) senior = data['desc'].str.contains('Senior Cat Food') qty = data['qty'] == 10 return data[senior & qty]['phone'].drop_duplicates().iloc[0] # --------------------------------------------------------------------------------------------- assert solve() == '631-507-6048' |