Skip to content

Instantly share code, notes, and snippets.

@DAYA7624 DAYA7624/EDA
Last active May 23, 2020

Embed
What would you like to do?
train_session_join
# Join train and session to find no of users with log information
left=train.drop_duplicates(subset='id', keep='first')
right = session.drop_duplicates(subset='user_id', keep='first')
merge_id=left.merge(right, left_on='id', right_on='user_id', how='inner')
# print info
print("Train :",left.shape)
print("Session:",right.shape)
print("Merge :",merge_id.shape)
print("No of users in Train Data with Session Information:",merge_id.shape[0])
print("{} / {} = {}".format(merge_id.shape[0],left.shape[0],np.round((merge_id.shape[0]/left.shape[0]),2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.