import numpy as np
import pandas as pd
prices = np.array([4.75, 5.50, 5.00, 6.00, 6.25], dtype='float32')
prices.shape
(5,)
tea_prices = pd.DataFrame(prices,
index=["Oolong Tea", "Jasmine Tea", "Green Tea", "Matcha", "Hot Cocoa"],
columns=["Price ($)"])
tea_prices
Price ($) | |
---|---|
Oolong Tea | 4.75 |
Jasmine Tea | 5.50 |
Green Tea | 5.00 |
Matcha | 6.00 |
Hot Cocoa | 6.25 |
np.random.seed(3000)
cups_sold = np.random.randint(50, 250, size=(7,5))
cups_sold
array([[101, 51, 224, 231, 76], [134, 139, 128, 180, 80], [ 90, 172, 219, 193, 138], [208, 68, 237, 144, 154], [212, 140, 116, 149, 243], [ 97, 70, 57, 92, 85], [231, 159, 247, 200, 51]])
daily_sales = pd.DataFrame(cups_sold,
index=["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
columns=["Oolong Tea", "Jasmine Tea", "Green Tea", "Matcha", "Hot Cocoa"])
daily_sales
Oolong Tea | Jasmine Tea | Green Tea | Matcha | Hot Cocoa | |
---|---|---|---|---|---|
Mon | 101 | 51 | 224 | 231 | 76 |
Tue | 134 | 139 | 128 | 180 | 80 |
Wed | 90 | 172 | 219 | 193 | 138 |
Thu | 208 | 68 | 237 | 144 | 154 |
Fri | 212 | 140 | 116 | 149 | 243 |
Sat | 97 | 70 | 57 | 92 | 85 |
Sun | 231 | 159 | 247 | 200 | 51 |
# Daily Sales (7,5)
# Prices (5,1)
opening_week_sales = daily_sales.dot(prices)
opening_week_sales # Type: pandas.core.series.Series
Mon 3741.25 Tue 3621.00 Wed 4489.00 Thu 4373.50 Fri 4769.75 Sat 2214.00 Sun 4725.50 dtype: float64
daily_sales["Total ($)"] = opening_week_sales
daily_sales
Oolong Tea | Jasmine Tea | Green Tea | Matcha | Hot Cocoa | Total ($) | |
---|---|---|---|---|---|---|
Mon | 101 | 51 | 224 | 231 | 76 | 3741.25 |
Tue | 134 | 139 | 128 | 180 | 80 | 3621.00 |
Wed | 90 | 172 | 219 | 193 | 138 | 4489.00 |
Thu | 208 | 68 | 237 | 144 | 154 | 4373.50 |
Fri | 212 | 140 | 116 | 149 | 243 | 4769.75 |
Sat | 97 | 70 | 57 | 92 | 85 | 2214.00 |
Sun | 231 | 159 | 247 | 200 | 51 | 4725.50 |