Skip to content

Latest commit

 

History

History
137 lines (93 loc) · 5.1 KB

File metadata and controls

137 lines (93 loc) · 5.1 KB

Telling Stories With Data

Coffee shop example

Written by Tanu Nanda Prabhu

space-1.jpg
Photo by Nathan Dumlao on Unsplash

Introduction

Do you drink coffee every day? I do 6-7 times a day. Coffee’s for closers, right! Every time I go to a coffee store (Tim Hortons, both here in Calgary and Bengaluru), I always ask myself these 3 things:

  • Which day is the busiest?
  • When do pastries sell more on weekends or weekdays?
  • What day of the week generates the highest revenue?

The store manager can obviously answer this, but he does not remember it off the top of his head. He refers to something called a dataset. This is where all the answers to my questions lie. Let’s take a tour of exploring a made-up dataset and understanding the art of storytelling.


Dataset

Here’s a small Coffee Shop Sales dataset we’ll analyze:

space-1.jpg
Sample dataset generated by Author

Like I said earlier, this is a simple dataset that comprises basic information that one can access for free.


Generating the dataset

We only need to import the pandas library to perform basic exploration and generate the dataset. Here is how we can do it.

# Importing Necessary Library
import pandas as pd

# Coffee Shop Sales dataset
data = {
    "Date": ["2025-08-01", "2025-08-02", "2025-08-03", "2025-08-04", "2025-08-05", "2025-08-06", "2025-08-07"],
    "Day": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
    "Coffee Sold": [120, 95, 110, 105, 130, 85, 90],
    "Pastries Sold": [45, 38, 50, 42, 55, 70, 65],
    "Revenue ($)": [860, 720, 800, 770, 940, 780, 760]
}

df = pd.DataFrame(data)
df

Output

space-1.jpg
Coffee Sales Dataset: Clean Version

This will give you the clean table of data inside your notebook. Say thanks to Dataframe!


What days are the busiest (coffee sales)?

You may take some time and calculate this by yourself, but why so much hassle when you have the libraries and their functions that do the same? Always remember, time efficiency matters the most!

busiest_day = df.loc[df["Coffee Sold"].idxmax()]
busiest_day

Output

space-1.jpg
Busiest day of the week in terms of sales

Answer

Friday is the busiest day, with 130 cups of coffee sold. It makes sense; the weekend is near, and people fuel up and have money to spend!


Do pastries sell more on weekends or weekdays?

What do you think? Let me know your answers in the comment section below before executing the code. I would say it's the weekend, because it makes sense logically that people have more time and no restrictions. Let's see what our function tells us.

# Calculate totals
weekday_pastries = df.loc[df["Day"].isin(["Monday","Tuesday","Wednesday","Thursday","Friday"]), "Pastries Sold"].sum()
weekend_pastries = df.loc[df["Day"].isin(["Saturday","Sunday"]), "Pastries Sold"].sum()

weekday_pastries, weekend_pastries

Output

(np.int64(230), np.int64(135))

Answer

Weekends win! Weekday pastries sold = 230

People treat themselves to pastries on weekends more than on weekdays. Am I right or wrong?)


What day has the highest revenue?

Obviously, it’s easy to tell the answer to this question. What if there are over a few hundred thousand entries? That’s why you get used to using Dataframes. It will save so much of your time and make you look cool in front of your non-tech friends. Try it out; it works.

highest_revenue = df.loc[df["Revenue ($)"].idxmax()]
highest_revenue

Output

space-1.jpg
Busiest day in terms of sales in a week

Answer

Friday again! With $940 in revenue, it’s the most profitable day.


Key Takeaways

To summarize

  • Friday is the busiest coffee day of the week, and it brings the highest revenue. Also on Friday, the shop sold 130 cups of coffee.
  • Pastries shine on weekends. More people = More revenue (More = More).
  • Even with a tiny dataset, we can already see patterns and tell stories.

Conclusion

This small exercise shows how Data Science isn’t just about numbers; it’s about uncovering insights and telling stories that matter. Whether you’re running a coffee shop or analyzing millions of rows of customer data, the principles remain the same: ask questions, explore data, and let the story unfold. This is the end. Let me know if you have any extraordinary ideas or solutions for any dataset. I’m all ears. I hope you guys had fun reading my article. Until then, see you next time. Happy data exploring!