My dataframe is something like this:
userid codeassigned timestamp 15 553938 M1 1499371200000
You need merge for inner join with filtered subset:
subset_df = df.loc[~mask, ['userid', 'timestamp']] df = subset_df.merge(df)
Or:
df = subset_df[['userid', 'timestamp']].merge(df)