-
-
Save DAYA7624/5ed7ecc01643fa775ec29caf4840e5e5 to your computer and use it in GitHub Desktop.
train_session_join
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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