Skip to content

Instantly share code, notes, and snippets.

@databyjp
Created March 29, 2021 04:22
Show Gist options
  • Save databyjp/fb7a9e654698982911a426efdb77c62d to your computer and use it in GitHub Desktop.
Save databyjp/fb7a9e654698982911a426efdb77c62d to your computer and use it in GitHub Desktop.
temp_syms = [s for s in list(sp500_df[sp500_df.Sector == sect].Symbol.values) if s in df.symbol.unique()]
temp_syms = random.sample(temp_syms, n_symbols)
pf1_df = df[df.symbol.isin(temp_syms)]
pf1_avg = get_avg_prices(pf1_df)
pf1_var = pf1_avg.var()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment