{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Soda profits\n", "\n", "The Coca-Cola Co spreadsheet[1] is missing some calculations. \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Loading data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# install the necessary dependencies\n", "import sys\n", "!{sys.executable} -m pip install --quiet ipython-sql\n", "\n", "%load_ext sql" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# download data file\n", "!curl https://raw.githubusercontent.com/ocademy-ai/machine-learning/main/open-machine-learning-jupyter-book/assets/data/coca_cola_co.sqlite -o ./coca_cola_co.sqlite\n", "\n", "# loading from disk\n", "%sql sqlite:///coca_cola_co.sqlite\n", "\n", "# clear tmp data file\n", "!rm -rf coca_cola_co.sqlite\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's have a look at some sample data." ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " * sqlite:///coca_cola_co.sqlite\n", "Done.\n" ] }, { "data": { "text/html": [ "
| year | \n", "Net operating revenues | \n", "Cost of goods sold | \n", "Gross Profit | \n", "
|---|---|---|---|
| 09 | \n", "30990.00 | \n", "11088.00 | \n", "19902.00 | \n", "
| 10 | \n", "35119.00 | \n", "12693.00 | \n", "22426.00 | \n", "
| 11 | \n", "46542.00 | \n", "18215.00 | \n", "28327.00 | \n", "
| 12 | \n", "48017.00 | \n", "19053.00 | \n", "28964.00 | \n", "
| 13 | \n", "46854.00 | \n", "18421.00 | \n", "28433.00 | \n", "
| 14 | \n", "45998.00 | \n", "17889.00 | \n", "28109.00 | \n", "
| 15 | \n", "44294.00 | \n", "17482.00 | \n", "\n", " |
| 16 | \n", "41863.00 | \n", "16465.00 | \n", "\n", " |
| 17 | \n", "35410.00 | \n", "13255.00 | \n", "\n", " |
| 18 | \n", "31856.00 | \n", "11770.00 | \n", "\n", " |