Data Driven Coffee Consumption
Using Python and Data Analysis Optimization techniques to save money on coffee.
This article was written as a “live blog” where I conducted the analysis and wrote down my thoughts and procedures as I went. The code can be found here!! If you like this “live blog” style let me know in the comments and I will try to do it more often. Enjoy!
This weekend I went to Disney Springs and as I was sitting having lunch I noticed how many people had Starbucks coffee in their hands. Not that it is unusual for a lot of people to be drinking Starbucks, but it just occurred to me that when I was living in Atlanta a local Starbucks had an offer: Buy a reusable cup and get (brewed) coffee for $1. At that moment, while eating lunch, I thought, “Is that financially responsible?” and “How much coffee would you have to drink for that to balance out?” So today’s analysis aims to solve those questions.
Problem Statement (or Research Question)
What is the most economically reasonable way to consume coffee?
Constraints
Our research question is a little broad and so I am going to operationally define this as a choice between alternatives. Our alternative options are:
- Drink out (at Starbucks — probably the most expensive coffee but oh, well)
- Drink out w/ discount/refill cup (also at Starbucks)
- Drink at home using single serve machine (Keurig, for example)
- Drink at home using traditional coffee pot
We are also going to limit ourselves to two (2) cups of coffee per day. Whether this is not enough or too much for you, you can change the CUPS_PER_DAY
global variable in the script to see varying results 😁
Alright, enough jabber, let’s starting hacking 👨💻
Getting Started
On second thought, it’s usually better to think before typing. So let’s think about some resources we will need to effectively answer our question.
- How much is a standard cup of Starbucks coffee?
- How many ounces is this?
- How much is a reusable Starbucks cup?
- What is the discounted coffee rate?
- How much is a Keurig machine?
- What does it require to work? (K-cups — Starbucks brand)
- How much does this requirement cost?
- How much is a traditional coffee pot?
- What does this require to work? (Beans — Starbucks brand)
- How much does this requirement cost?
You may ask yourself why we are using Starbucks brand beans and K-cups when they will obviously be more expensive. The answer is to standardize our data. We could option for cheaper beans, but the coffee would taste different. Not all coffee is created equal. Thus we should use standard coffee grinds.
I am by no means saying Starbucks beans are the best coffee, just was the first thing that came to mind.
Ok. Now let’s start researching 🧐
Background Research / Intelligence Gathering / Data Collection
Whatever you want to call it, we need to collect information on these questions to accurately solve our problem.
First let’s look at Starbucks. According to their website and menu I can order a cup of Pike’s Place Roast (12oz) for $2.25 at my local shop. This is before tax. (We will exclude tax throughout this entire process since it is a constant). I should also note we will be using USD as our currency.
Now, their reusable plastic tumbler (which is practically identical to their normal paper cups) is $2.00 for a one time purchase and it get’s you $0.10 discount per cup of similar size. I think we could technically get Lattes etc. with this but let’s stick with drip coffee.
Edit: Technically our cup won’t get full with a 12oz order, but finding 16oz K-cups was excruciating so I went back and edited this from 16oz to 12oz.
Up next is Keurig. The K-Mini Single Serve Coffee Maker (link) is the cheapest 12oz coffee maker I saw (without sales) immediately on Keurig’s website. It is valued at $79.99.
Now looking for K-cups, Keurig sells Pike’s Peak Starbucks K-cups for varied prices. Buying in bulk saves, as it usually does. So I am going to go with a one-time purchase of 96 K-cup pods. I just need to keep in mind that we are now limited to 96 cups of coffee unless we want to buy more K-cups.
Note: there is an option for a subscription which lets you save a few more cents on each K-cup, but I excluded that for this analysis.
Lastly, we need a normal coffee brewer and beans. For these, I went to Amazon. I was able to find Starbucks Pike’s Peak grounds for a one time-purchase of $14.85. I elected for the larger, 1.75 pound (28 ounces) bag. Like I did for K-cups do maximize savings. The packaging recommends 2 tablespoons per 6 fluid ounces of water. So we can assume 4 tablespoons for our 12oz cup of coffee. Based on a quick google search, 1 US tablespoon is roughly equivalent to 0.5 ounces. (This may or may not be entirely accurate, but I assume Google to be right in this case). We also need a coffee maker. I found this decent Black & Decker coffee maker for $19.74 on Amazon.
Great! We now have enough information to proceed with analysis.
Finally, let’s start hacking! 👨💻
Problem Setup
Before we begin writing some functions to handle our math, we need to identify a few global constants. Each of these correspond to various real objects we have already found. For example, the price of a Keurig coffee maker ($79.99 in case you forgot).
So, let’s declare some global variables:
* All this code is available in the gist at the end of this article.
I just realized, in addition to our K-cups running out, our coffee beans have a limited lifespan as well. To be precise, our bag only gives us 14 cups of coffee (or enough for 7 days). So to adjust this, we will order more bags.
Analysis
Now we can write a few functions to generate data for each of our four options over time.
Evaluation
In order to evaluate our results, we can make a line graph as the easiest way to visualize and quickly identify trends. I will use plotly
so I need to transform our data into a pandas data frame (which I will leave to you). Here we plot the four options over the course of a year:
And you can see the results:
Interestingly, the Keurig plus K-cups win out after about three months. However, more interesting is that if we decrease our consumption to ONE cup per day, the difference between standard coffee pot usage and the Keurig goes down considerably.
For more tangible differences, we can see the yearly totals for each option given 1 or 2 cups per day are consumed.
Two cups per day:
One cup per day:
Results
So, as it turns out, if you are in the market for a new coffee setup, buy a Keurig single serve coffee maker, and buy K-cups in bulk!