Code
import polars as pl
import json
import polars.selectors as cs
import typing_extensions
from great_tables import GT, loc, style
import polars as pl
import json
import polars.selectors as cs
import typing_extensions
from great_tables import GT, loc, style
Importing the data.
# Load JSON file
with open("coffee-sales.json", "r") as f:
= json.load(f)
raw_data
# Extract column names
= [col["name"] for col in raw_data["columns"]]
columns
# Extract values and convert to rows
= list(zip(*[col["values"] for col in raw_data["columns"]]))
values
# Convert to list of dictionaries while extracting only the list from 'monthly_sales'
= []
data for row in values:
= dict(zip(columns, row))
row_dict
# Extract only the list from the "monthly_sales" column
if "monthly_sales" in row_dict:
if isinstance(row_dict["monthly_sales"], dict) and "values" in row_dict["monthly_sales"]:
"monthly_sales"] = row_dict["monthly_sales"]["values"] # Extract only the list
row_dict[
data.append(row_dict)
# Create Polars DataFrame
= pl.DataFrame(data)
coffee_sales
coffee_sales
icon | product | revenue_dollars | revenue_pct | profit_dollars | profit_pct | monthly_sales |
---|---|---|---|---|---|---|
str | str | f64 | f64 | f64 | f64 | list[i64] |
"grinder.png" | "Grinder" | 904500.0 | 0.03 | 567960.0 | 0.04 | [521, 494, … 751] |
"moka-pot.png" | "Moka pot" | 2.04525e6 | 0.07 | 181080.0 | 0.01 | [4726, 4741, … 6283] |
"cold-brew.png" | "Cold brew" | 288750.0 | 0.01 | 241770.0 | 0.02 | [244, 249, … 244] |
"filter.png" | "Filter" | 404250.0 | 0.01 | 70010.0 | 0.0 | [2067, 1809, … 2744] |
"drip-machine.png" | "Drip machine" | 2.632e6 | 0.09 | 1.37445e6 | 0.09 | [2137, 1623, … 2328] |
… | … | … | … | … | … | … |
"chemex.png" | "Chemex" | 3.13725e6 | 0.11 | 817680.0 | 0.06 | [4938, 4167, … 7220] |
"scale.png" | "Scale" | 3.801e6 | 0.13 | 2.91029e6 | 0.2 | [1542, 1566, … 3180] |
"kettle.png" | "Kettle" | 756250.0 | 0.03 | 617520.0 | 0.04 | [1139, 1023, … 1529] |
"espresso-machine.png" | "Espresso Machine" | 8.406e6 | 0.29 | 3.63644e6 | 0.25 | [686, 840, … 2577] |
null | "Total" | 2.94485e7 | 1.0 | 1.479315e7 | 1.0 | null |
= GT(coffee_sales)
gt_tbl_1
gt_tbl_1
icon | product | revenue_dollars | revenue_pct | profit_dollars | profit_pct | monthly_sales |
---|---|---|---|---|---|---|
grinder.png | Grinder | 904500.0 | 0.03 | 567960.0 | 0.04 | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | 2045250.0 | 0.07 | 181080.0 | 0.01 | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | 288750.0 | 0.01 | 241770.0 | 0.02 | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | 404250.0 | 0.01 | 70010.0 | 0.0 | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | 2632000.0 | 0.09 | 1374450.0 | 0.09 | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | 2601500.0 | 0.09 | 1293780.0 | 0.09 | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | 846000.0 | 0.03 | 364530.0 | 0.02 | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | 1113250.0 | 0.04 | 748120.0 | 0.05 | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | 2512500.0 | 0.09 | 1969520.0 | 0.13 | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | 3137250.0 | 0.11 | 817680.0 | 0.06 | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | 3801000.0 | 0.13 | 2910290.0 | 0.2 | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | 756250.0 | 0.03 | 617520.0 | 0.04 | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | 8406000.0 | 0.29 | 3636440.0 | 0.25 | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | 29448500.0 | 1.0 | 14793150.0 | 1.0 | None |
= gt_tbl_1.tab_header(
gt_tbl_2 = "Coffee Equipment Sales for 2023"
title
)
gt_tbl_2
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | revenue_dollars | revenue_pct | profit_dollars | profit_pct | monthly_sales |
grinder.png | Grinder | 904500.0 | 0.03 | 567960.0 | 0.04 | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | 2045250.0 | 0.07 | 181080.0 | 0.01 | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | 288750.0 | 0.01 | 241770.0 | 0.02 | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | 404250.0 | 0.01 | 70010.0 | 0.0 | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | 2632000.0 | 0.09 | 1374450.0 | 0.09 | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | 2601500.0 | 0.09 | 1293780.0 | 0.09 | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | 846000.0 | 0.03 | 364530.0 | 0.02 | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | 1113250.0 | 0.04 | 748120.0 | 0.05 | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | 2512500.0 | 0.09 | 1969520.0 | 0.13 | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | 3137250.0 | 0.11 | 817680.0 | 0.06 | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | 3801000.0 | 0.13 | 2910290.0 | 0.2 | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | 756250.0 | 0.03 | 617520.0 | 0.04 | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | 8406000.0 | 0.29 | 3636440.0 | 0.25 | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | 29448500.0 | 1.0 | 14793150.0 | 1.0 | None |
= gt_tbl_2.tab_spanner(
gt_tbl_3 ="Revenue", columns=cs.starts_with("revenue")
label
).tab_spanner( ="Profit", columns=cs.starts_with("profit")
label
)
gt_tbl_3
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | monthly_sales | ||
revenue_dollars | revenue_pct | profit_dollars | profit_pct | |||
grinder.png | Grinder | 904500.0 | 0.03 | 567960.0 | 0.04 | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | 2045250.0 | 0.07 | 181080.0 | 0.01 | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | 288750.0 | 0.01 | 241770.0 | 0.02 | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | 404250.0 | 0.01 | 70010.0 | 0.0 | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | 2632000.0 | 0.09 | 1374450.0 | 0.09 | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | 2601500.0 | 0.09 | 1293780.0 | 0.09 | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | 846000.0 | 0.03 | 364530.0 | 0.02 | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | 1113250.0 | 0.04 | 748120.0 | 0.05 | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | 2512500.0 | 0.09 | 1969520.0 | 0.13 | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | 3137250.0 | 0.11 | 817680.0 | 0.06 | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | 3801000.0 | 0.13 | 2910290.0 | 0.2 | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | 756250.0 | 0.03 | 617520.0 | 0.04 | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | 8406000.0 | 0.29 | 3636440.0 | 0.25 | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | 29448500.0 | 1.0 | 14793150.0 | 1.0 | None |
= (
gt_tbl_4
gt_tbl_3
.cols_label(="Amount",
revenue_dollars= "Percent",
revenue_pct ="Amount",
profit_dollars= "Percent",
profit_pct = "Monthly Sales"
monthly_sales
)
)
gt_tbl_4
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
grinder.png | Grinder | 904500.0 | 0.03 | 567960.0 | 0.04 | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | 2045250.0 | 0.07 | 181080.0 | 0.01 | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | 288750.0 | 0.01 | 241770.0 | 0.02 | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | 404250.0 | 0.01 | 70010.0 | 0.0 | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | 2632000.0 | 0.09 | 1374450.0 | 0.09 | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | 2601500.0 | 0.09 | 1293780.0 | 0.09 | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | 846000.0 | 0.03 | 364530.0 | 0.02 | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | 1113250.0 | 0.04 | 748120.0 | 0.05 | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | 2512500.0 | 0.09 | 1969520.0 | 0.13 | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | 3137250.0 | 0.11 | 817680.0 | 0.06 | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | 3801000.0 | 0.13 | 2910290.0 | 0.2 | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | 756250.0 | 0.03 | 617520.0 | 0.04 | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | 8406000.0 | 0.29 | 3636440.0 | 0.25 | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | 29448500.0 | 1.0 | 14793150.0 | 1.0 | None |
= (
gt_tbl_5
gt_tbl_4=cs.ends_with("dollars"),
.fmt_currency(columns=False
use_subunits
)
)
gt_tbl_5
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
grinder.png | Grinder | $904,500 | 0.03 | $567,960 | 0.04 | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | $2,045,250 | 0.07 | $181,080 | 0.01 | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | $288,750 | 0.01 | $241,770 | 0.02 | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | $404,250 | 0.01 | $70,010 | 0.0 | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | $2,632,000 | 0.09 | $1,374,450 | 0.09 | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | $2,601,500 | 0.09 | $1,293,780 | 0.09 | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | $846,000 | 0.03 | $364,530 | 0.02 | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | $1,113,250 | 0.04 | $748,120 | 0.05 | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | $2,512,500 | 0.09 | $1,969,520 | 0.13 | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | $3,137,250 | 0.11 | $817,680 | 0.06 | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | $3,801,000 | 0.13 | $2,910,290 | 0.2 | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | $756,250 | 0.03 | $617,520 | 0.04 | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | $8,406,000 | 0.29 | $3,636,440 | 0.25 | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | $29,448,500 | 1.0 | $14,793,150 | 1.0 | None |
= (
gt_tbl_6
gt_tbl_5
.fmt_percent(=cs.ends_with("pct"),
columns =0
decimals
)
)
gt_tbl_6
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
grinder.png | Grinder | $904,500 | 3% | $567,960 | 4% | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | $2,045,250 | 7% | $181,080 | 1% | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | $288,750 | 1% | $241,770 | 2% | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | $404,250 | 1% | $70,010 | 0% | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | $2,632,000 | 9% | $1,374,450 | 9% | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | $2,601,500 | 9% | $1,293,780 | 9% | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | $846,000 | 3% | $364,530 | 2% | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | $1,113,250 | 4% | $748,120 | 5% | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | $2,512,500 | 9% | $1,969,520 | 13% | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | $3,137,250 | 11% | $817,680 | 6% | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | $3,801,000 | 13% | $2,910,290 | 20% | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | $756,250 | 3% | $617,520 | 4% | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | $8,406,000 | 29% | $3,636,440 | 25% | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | $29,448,500 | 100% | $14,793,150 | 100% | None |
= (
gt_tbl_7
gt_tbl_6
.tab_style(= style.fill(color="aliceblue"),
style=loc.body(columns=cs.starts_with("revenue"))
locations
)
)
gt_tbl_7
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
grinder.png | Grinder | $904,500 | 3% | $567,960 | 4% | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | $2,045,250 | 7% | $181,080 | 1% | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | $288,750 | 1% | $241,770 | 2% | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | $404,250 | 1% | $70,010 | 0% | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | $2,632,000 | 9% | $1,374,450 | 9% | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | $2,601,500 | 9% | $1,293,780 | 9% | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | $846,000 | 3% | $364,530 | 2% | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | $1,113,250 | 4% | $748,120 | 5% | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | $2,512,500 | 9% | $1,969,520 | 13% | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | $3,137,250 | 11% | $817,680 | 6% | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | $3,801,000 | 13% | $2,910,290 | 20% | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | $756,250 | 3% | $617,520 | 4% | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | $8,406,000 | 29% | $3,636,440 | 25% | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | $29,448,500 | 100% | $14,793,150 | 100% | None |
= (
gt_tbl_8
gt_tbl_7
.tab_style(= style.fill(color="papayawhip"),
style=loc.body(columns=cs.starts_with("profit"))
locations
)
)
gt_tbl_8
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
grinder.png | Grinder | $904,500 | 3% | $567,960 | 4% | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | $2,045,250 | 7% | $181,080 | 1% | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | $288,750 | 1% | $241,770 | 2% | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | $404,250 | 1% | $70,010 | 0% | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | $2,632,000 | 9% | $1,374,450 | 9% | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | $2,601,500 | 9% | $1,293,780 | 9% | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | $846,000 | 3% | $364,530 | 2% | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | $1,113,250 | 4% | $748,120 | 5% | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | $2,512,500 | 9% | $1,969,520 | 13% | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | $3,137,250 | 11% | $817,680 | 6% | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | $3,801,000 | 13% | $2,910,290 | 20% | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | $756,250 | 3% | $617,520 | 4% | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | $8,406,000 | 29% | $3,636,440 | 25% | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | $29,448,500 | 100% | $14,793,150 | 100% | None |
= (
gt_tbl_9
gt_tbl_8
.tab_style(=style.text(weight="bold"),
style=loc.body(rows= pl.col("product") == "Total"
locations
)
)
)
gt_tbl_9
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
grinder.png | Grinder | $904,500 | 3% | $567,960 | 4% | [521, 494, 596, 613, 667, 748, 765, 686, 607, 594, 568, 751] |
moka-pot.png | Moka pot | $2,045,250 | 7% | $181,080 | 1% | [4726, 4741, 4791, 5506, 6156, 6619, 6868, 6026, 5304, 4884, 4648, 6283] |
cold-brew.png | Cold brew | $288,750 | 1% | $241,770 | 2% | [244, 249, 438, 981, 1774, 2699, 2606, 2348, 1741, 896, 499, 244] |
filter.png | Filter | $404,250 | 1% | $70,010 | 0% | [2067, 1809, 1836, 2123, 2252, 2631, 2562, 2367, 2164, 2195, 2070, 2744] |
drip-machine.png | Drip machine | $2,632,000 | 9% | $1,374,450 | 9% | [2137, 1623, 1971, 2097, 2580, 2456, 2336, 2316, 2052, 1967, 1837, 2328] |
aeropress.png | AeroPress | $2,601,500 | 9% | $1,293,780 | 9% | [6332, 5199, 6367, 7024, 7906, 8704, 8693, 7797, 6828, 6963, 6877, 9270] |
pour-over.png | Pour over | $846,000 | 3% | $364,530 | 2% | [1562, 1291, 1511, 1687, 1940, 2177, 2141, 1856, 1715, 1806, 1601, 2165] |
french-press.png | French press | $1,113,250 | 4% | $748,120 | 5% | [3507, 2880, 3346, 3792, 3905, 4095, 4184, 4428, 3279, 3420, 3297, 4819] |
cezve.png | Cezve | $2,512,500 | 9% | $1,969,520 | 13% | [12171, 11469, 11788, 13630, 15391, 16532, 17090, 14433, 12985, 12935, 11598, 15895] |
chemex.png | Chemex | $3,137,250 | 11% | $817,680 | 6% | [4938, 4167, 5235, 6000, 6358, 6768, 7112, 6249, 5605, 6076, 4980, 7220] |
scale.png | Scale | $3,801,000 | 13% | $2,910,290 | 20% | [1542, 1566, 1681, 2028, 2425, 2549, 2569, 2232, 2036, 2089, 1693, 3180] |
kettle.png | Kettle | $756,250 | 3% | $617,520 | 4% | [1139, 1023, 1087, 1131, 1414, 1478, 1456, 1304, 1140, 1233, 1193, 1529] |
espresso-machine.png | Espresso Machine | $8,406,000 | 29% | $3,636,440 | 25% | [686, 840, 618, 598, 2148, 533, 797, 996, 1002, 668, 858, 2577] |
None | Total | $29,448,500 | 100% | $14,793,150 | 100% | None |
= (
gt_tbl_10
gt_tbl_9
.fmt_nanoplot(="monthly_sales",
columns="bar"
plot_type
)
)
gt_tbl_10
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
grinder.png | Grinder | $904,500 | 3% | $567,960 | 4% | |
moka-pot.png | Moka pot | $2,045,250 | 7% | $181,080 | 1% | |
cold-brew.png | Cold brew | $288,750 | 1% | $241,770 | 2% | |
filter.png | Filter | $404,250 | 1% | $70,010 | 0% | |
drip-machine.png | Drip machine | $2,632,000 | 9% | $1,374,450 | 9% | |
aeropress.png | AeroPress | $2,601,500 | 9% | $1,293,780 | 9% | |
pour-over.png | Pour over | $846,000 | 3% | $364,530 | 2% | |
french-press.png | French press | $1,113,250 | 4% | $748,120 | 5% | |
cezve.png | Cezve | $2,512,500 | 9% | $1,969,520 | 13% | |
chemex.png | Chemex | $3,137,250 | 11% | $817,680 | 6% | |
scale.png | Scale | $3,801,000 | 13% | $2,910,290 | 20% | |
kettle.png | Kettle | $756,250 | 3% | $617,520 | 4% | |
espresso-machine.png | Espresso Machine | $8,406,000 | 29% | $3,636,440 | 25% | |
None | Total | $29,448,500 | 100% | $14,793,150 | 100% | None |
= (
gt_tbl_11
gt_tbl_10.fmt_image(="icon",
columns=r"C:\Users\Hon.Olayinka\Documents\GitHub\Posit_PBC\GREAT_TABLES_PYTHON\Lesson_1\img"
path
)
)
gt_tbl_11
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
Grinder | $904,500 | 3% | $567,960 | 4% | ||
Moka pot | $2,045,250 | 7% | $181,080 | 1% | ||
Cold brew | $288,750 | 1% | $241,770 | 2% | ||
Filter | $404,250 | 1% | $70,010 | 0% | ||
Drip machine | $2,632,000 | 9% | $1,374,450 | 9% | ||
AeroPress | $2,601,500 | 9% | $1,293,780 | 9% | ||
Pour over | $846,000 | 3% | $364,530 | 2% | ||
French press | $1,113,250 | 4% | $748,120 | 5% | ||
Cezve | $2,512,500 | 9% | $1,969,520 | 13% | ||
Chemex | $3,137,250 | 11% | $817,680 | 6% | ||
Scale | $3,801,000 | 13% | $2,910,290 | 20% | ||
Kettle | $756,250 | 3% | $617,520 | 4% | ||
Espresso Machine | $8,406,000 | 29% | $3,636,440 | 25% | ||
None | Total | $29,448,500 | 100% | $14,793,150 | 100% | None |
= (
gt_tbl_12
gt_tbl_11="")
.sub_missing(missing_text
)
gt_tbl_12
Coffee Equipment Sales for 2023 | ||||||
---|---|---|---|---|---|---|
icon | product | Revenue | Profit | Monthly Sales | ||
Amount | Percent | Amount | Percent | |||
Grinder | $904,500 | 3% | $567,960 | 4% | ||
Moka pot | $2,045,250 | 7% | $181,080 | 1% | ||
Cold brew | $288,750 | 1% | $241,770 | 2% | ||
Filter | $404,250 | 1% | $70,010 | 0% | ||
Drip machine | $2,632,000 | 9% | $1,374,450 | 9% | ||
AeroPress | $2,601,500 | 9% | $1,293,780 | 9% | ||
Pour over | $846,000 | 3% | $364,530 | 2% | ||
French press | $1,113,250 | 4% | $748,120 | 5% | ||
Cezve | $2,512,500 | 9% | $1,969,520 | 13% | ||
Chemex | $3,137,250 | 11% | $817,680 | 6% | ||
Scale | $3,801,000 | 13% | $2,910,290 | 20% | ||
Kettle | $756,250 | 3% | $617,520 | 4% | ||
Espresso Machine | $8,406,000 | 29% | $3,636,440 | 25% | ||
Total | $29,448,500 | 100% | $14,793,150 | 100% |