We all know it by intuition: hot days and ice cream are a perfect match. But what if we could go beyond intuition? What if we could use data to create a true "crystal ball" capable of predicting exactly how much an ice cream shop's revenue could increase with every degree the temperature rises?
This project does just that. We dove into a sales dataset to turn common sense into a precise mathematical model. Using Linear Regression, we deciphered the relationship between temperature and revenue, creating a tool to forecast sales success before the sun even hits its peak.
To make this analysis accessible to everyone, we built a visual oracle in Looker Studio. On this interactive dashboard, you can adjust the temperature with a slider and watch the revenue forecast respond in real-time. It's not just a chart; it's your chance to predict the future of sales.
>> Consult the Interactive Oracle Here <<
Our analysis confirmed what we suspected: there is a strong, clear linear connection between temperature and revenue. Using the Scikit-learn library, we taught a model to "learn" this relationship and translate it into a powerful predictive formula.
The model revealed the following equation to predict revenue:
- Coefficient (m):
21.44
- Intercept (c):
44.27
What does this mean? The revelation is simple and powerful: the model predicts that for every 1°C increase in temperature, the ice cream shop's revenue is expected to increase by approximately $21.44.
To validate our model, we made a prediction:
- For a day with a temperature of 25°C, the predicted revenue is $580.31.
The scatter plot below leaves no doubt. The red line, representing our model's predictions, fits the real-world data perfectly, visually confirming the strong positive correlation.
Our journey wouldn't have been possible without the manuscripts containing the secrets of past sales. We used the "Ice Cream Sales Dataset," originally sourced from Kaggle.
- Original Source: Ice Cream Sales Dataset on Kaggle
- Author: Sakshi Satre
The df_final_ice_cream.csv
file in this repository is the cleaned and prepared version, containing the two columns essential for our magic: Temperature
(°C) and Revenue
($).
To turn raw data into predictive gold, we used the following tools:
- Language: Python
- Magic Libraries:
- Pandas (for organizing and manipulating data)
- Matplotlib & Seaborn (for visualizations and charts)
- Scikit-learn (for conjuring the Linear Regression model)
- Spellcasting Environment: Jupyter Notebook
- BI Tool: Looker Studio (for our interactive oracle)
Follow these steps to run the analysis and make your own predictions:
-
Clone the repository:
git clone [https://github.com/OYanEnrique/ice-cream-revenue-prediction.git](https://github.com/OYanEnrique/ice-cream-revenue-prediction.git) cd ice-cream-revenue-prediction
-
Install the necessary ingredients:
pip install pandas matplotlib seaborn scikit-learn jupyterlab
-
Start the lab:
jupyter lab
-
Open and run the
ice_cream_data.ipynb
notebook to witness the full analysis.
- Yan Enrique
- LinkedIn: https://www.linkedin.com/in/yanenrique/
- GitHub: https://github.com/OYanEnrique
- Landing page: https://yanenrique.carrd.co