Closed hcchuang closed 4 months ago
The calculation of dy is correct? or it should be dy=lambda x: np.log(x["D12"])-np.log(x["Index"].shift(1)),
macro_predictors = ( pd.read_csv(macro_predictors_link, thousands=",") .assign( month=lambda x: pd.to_datetime(x["yyyymm"], format="%Y%m"), dp=lambda x: np.log(x["D12"])-np.log(x["Index"]), dy=lambda x: np.log(x["D12"])-np.log(x["D12"].shift(1)), ep=lambda x: np.log(x["E12"])-np.log(x["Index"]), de=lambda x: np.log(x["D12"])-np.log(x["E12"]), tms=lambda x: x["lty"]-x["tbl"], dfy=lambda x: x["BAA"]-x["AAA"] ) .rename(columns={"b/m": "bm"}) .get(["month", "dp", "dy", "ep", "de", "svar", "bm", "ntis", "tbl", "lty", "ltr", "tms", "dfy", "infl"]) .query("month >= @start_date and month <= @end_date") .dropna() )
@hcchuang This is indeed a typo. Thank you for spotting it.
Changed with https://github.com/tidy-finance/website/commit/c0f5cc09e00d9ab7f6dfc9eb55f89ed2fc090a02
The calculation of dy is correct? or it should be dy=lambda x: np.log(x["D12"])-np.log(x["Index"].shift(1)),
macro_predictors = ( pd.read_csv(macro_predictors_link, thousands=",") .assign( month=lambda x: pd.to_datetime(x["yyyymm"], format="%Y%m"), dp=lambda x: np.log(x["D12"])-np.log(x["Index"]), dy=lambda x: np.log(x["D12"])-np.log(x["D12"].shift(1)), ep=lambda x: np.log(x["E12"])-np.log(x["Index"]), de=lambda x: np.log(x["D12"])-np.log(x["E12"]), tms=lambda x: x["lty"]-x["tbl"], dfy=lambda x: x["BAA"]-x["AAA"] ) .rename(columns={"b/m": "bm"}) .get(["month", "dp", "dy", "ep", "de", "svar", "bm", "ntis", "tbl", "lty", "ltr", "tms", "dfy", "infl"]) .query("month >= @start_date and month <= @end_date") .dropna() )