Fix CA tsne issue where dataframes werent merging when ticker not in sp500 (#1882)

* Fix CA tsne issue where dataframes werent merging

* Fix forex tests where date changed :/
This commit is contained in:
James Maslek
2022-05-31 13:20:28 -04:00
committed by GitHub
parent f7f16b2597
commit 1e0959845e

View File

@@ -119,9 +119,10 @@ def get_sp500_comps_tsne(
"Adj Close"
].to_frame()
df_ticker.columns = [ticker]
close_vals = close_vals.join(df_ticker, how="inner")
df_ticker.index = df_ticker.index.astype(str)
close_vals = close_vals.join(df_ticker)
close_vals = close_vals.dropna(how="all").fillna(method="bfill")
close_vals = close_vals.fillna(method="bfill")
rets = close_vals.pct_change()[1:].T
model = TSNE(learning_rate=lr)