python loc id in list code example
Example: python loc id in list
In [30]: df = pd.DataFrame({'subscriber_id':[1,2,3,4,5]})
''' subscriber_id
0 1
1 2
2 3
3 4
4 5 '''
mask = df['subscriber_id'].isin([2,4,5])
''' 0 False
1 True
2 False
3 True
4 True '''
df.loc[mask]
''' subscriber_id
1 2
3 4
4 5 '''