Skip to content

Instantly share code, notes, and snippets.

@sjster
Created June 27, 2022 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjster/f5a51f19bf818d540327ac7b0f8f5769 to your computer and use it in GitHub Desktop.
Save sjster/f5a51f19bf818d540327ac7b0f8f5769 to your computer and use it in GitHub Desktop.
def read_inputs_join(ev: pd.DataFrame, tu: pd.DataFrame, df_target: pd.DataFrame) -> pd.DataFrame:
print(ev.head())
print(tu.head())
ev.set_index('IDENTITY_ID', inplace=True)
tu.set_index('IDENTITY_ID', inplace=True)
df_target.set_index('IDENTITY_ID', inplace=True)
log = logging.getLogger(__name__)
log.info(f"Length of ev is {len(ev)}")
log.info(f"Length of tu is {len(tu)}")
log.info(f"Length of target is {len(df_target)}")
df_joined = ev.join(tu, how='inner')
df_ev_tu_target = df_target.join(df_joined, how='inner')
print("Target type is ",type(df_ev_tu_target))
log.info(f"Length of target joined with es_tu is {len(df_ev_tu_target)}")
return(df_ev_tu_target)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment