a=np.random.randint(10,size=(3,3))
b=np.random.randint(10,size=(3,3))
c=np.random.randint(10,size=(3,3))
d=[np.vstack([a,b,c])]
df=pd.DataFrame(d,columns=['a','b','c'])
def filter_func(x):
return 0 if x<5 else 1
df.groupby('a').filter(filter_func)
This's just an examle. I got the 'The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().' message. What am i doing wrong??