Skip to content

Instantly share code, notes, and snippets.

@Kazanskyi
Last active September 2, 2022 18:45
Show Gist options
  • Save Kazanskyi/d77b2b13a927181471c0c068c02f7282 to your computer and use it in GitHub Desktop.
Save Kazanskyi/d77b2b13a927181471c0c068c02f7282 to your computer and use it in GitHub Desktop.
target_vars = ["future_15dprice_change", "future_30dprice_change", "future_60dprice_change", "future_90dprice_change", "future_120dprice_change", "future_150dprice_change"]
min_15d_threshold = 0.038
min_30d_threshold = 0.059
min_60d_threshold = 0.093
min_90d_threshold = 0.122
min_120d_threshold = 0.148
min_150d_threshold = 0.173
list_of_thresholds = [min_15d_threshold,min_30d_threshold,min_60d_threshold,min_90d_threshold,min_120d_threshold,min_150d_threshold]
df_compact_reserve = df_compact.copy()
for i, j in enumerate(target_vars):
df_compact.loc[df_compact[j]<list_of_thresholds[i], j] = 0
df_compact.loc[df_compact[j]>=list_of_thresholds[i], j] = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment