# Ceteris Lab downloadable Python script
# Course: Fundamentals of Python for Financial Econometrics

import pandas as pd

df = pd.DataFrame({
    "province": ["ON", "QC", "BC", "ON"],
    "income": [62_000, 58_000, 65_000, 71_000],
    "employed": [True, True, False, True],
})
print(df.shape)
print(df.dtypes.astype(str).to_dict())

high_income = (
    df.loc[df["income"] >= 60_000]
      .assign(income_thousands=lambda x: x["income"] / 1_000)
      .sort_values("income", ascending=False)
)
print(high_income[["province", "income_thousands"]])
