I wrote code that looks for all 'Contact' (grouped by Name) that is done via email. It's done with .isin(), then, extracts the True booleans to create a new dataframe. Is there a faster and simpler way for doing this?
df = pd.DataFrame({'Name':['adam','ben','ben','ben','adam','adam','adam'],
'Date':['2014-06-01 18:47:05.069722','2014-06-01 18:47:05.069722','2014-06-30 13:47:05.069722',
'2013-06-01 18:47:05.069722','2014-01-01 18:47:05.06972','2014-06-01 18:47:05.06972',
'2014-06-02 18:47:05.06972'],
'Contact':['phone','email','email','email','email','email','Nan']})
"""Pull only those rows where form of Contact is 'email', to construct new dataframe"""
emails = df.groupby('Name')['Contact'].apply(lambda i: i.isin(['email']))
a = list(np.where(email)) #create list of indices of True booleans
lst = a[0]
df = df.iloc[lst, :] #new dataframe