Cartesian product of a dataframe and a list
October 12, 2022
df = (
pd.concat([pd.DataFrame(date_range)] * len(portfolio_codes), keys=portfolio_codes)
.reset_index(level=1, drop=True)
.rename_axis("portfolio_id")
.reset_index()
.assign(**{"return": np.nan})
)