dfply
dfply copied to clipboard
Can I use `%in%` operator in dfply framework?
Can I use %in%
operator in dfply framework?
here is an example.
# Import
import pandas as pd
import numpy as np
from dfply import *
# Create data frame and mask it
df = pd.DataFrame({'a':[np.nan,2,3,4,5],'b':[6,7,8,9,np.nan],'c':[5,4,3,2,1]})
I just want to filter A with '%in%' operator, not '|' operator as follow
df >> mask(X.A %in% [2,3,4])
you could use df >> mask(X.A.isin([2,3,4]))