# Chapter 1: Welcome to Python and Ceteris LAB
# Fundamentals of Python for Financial Econometrics - Welcome to Python and Ceteris LAB
# Dataset: Ceteris Lab teaching sample

# Welcome to Python and Ceteris LAB
#
# **Opening question:** How can one language carry an economic question from raw observations to a reproducible conclusion?

# %% Cell 2
import pandas as pd

inflation = pd.DataFrame({
    "month": ["Jan", "Feb", "Mar", "Apr"],
    "rate": [2.9, 2.8, 2.7, 2.6],
})
print(inflation["rate"].mean())
print(inflation.tail(2))

# **Interpretation check:** Interpretation. The mean summarizes the four observations, while the final rows preserve the temporal detail. A statistic and the underlying data answer different questions.

# %% Cell 4
principal = 1_000
annual_rate = 0.045
years = 3
future_value = principal * (1 + annual_rate) ** years
print(f"Future value: ${future_value:,.2f}")

# **Interpretation check:** Interpretation. Clear names make the calculation readable as a small model rather than a string of unexplained numbers.

# Verified source output
#
# ```text
# 2.7499999999999996 month rate 2 Mar 2.7 3 Apr 2.6
# ```
#
# ```text
# Future value: $1,141.17
# ```
#
# ```text
# 2.7499999999999996
#   month  rate
# 2   Mar   2.7
# 3   Apr   2.6
# ```
#
# ```text
# import pandas as pd
# inflation = pd.DataFrame({
# print(inflation["rate"].mean())
# print(inflation.tail(2))
# future_value = principal * (1 + annual_rate) ** years
# print(f"Future value: ${future_value:,.2f}")
# ```
