Skip to content

Price Gouging Problem


You suspect your local grocery’s been price gouging the ground beef. You and some friends decide to track the price of ground beef every day for 10 days. You’ve compiled the data into a Series called beef_prices, whose index represents the day of each recording.

import numpy as np
import pandas as pd

generator = np.random.default_rng(123)
beef_prices = pd.Series(
    data = np.round(generator.uniform(low=3, high=5, size=10), 2),
    index = generator.choice(10, size=10, replace=False)
)

print(beef_prices)
# 4    4.36
# 8    3.11
# 2    3.44
# 0    3.37
# 6    3.35
# 9    4.62
# 3    4.85
# 5    3.55
# 1    4.64
# 7    4.78
# dtype: float64

For example, beef was priced 3.37 on the first day, 4.64 on the second day, etc.

Determine which day had the biggest price increase from the prior day.


Try with Google Colab