I have the Yelp dataset and I want to count all reviews which have greater than 3 stars. I get the count of reviews by doing this:
reviews.groupby(\'business
A bit late, but my solution is:
reviews.groupby('business_id').stars.apply(lambda x: len(x[x>3]) )
I came across this thread in search of finding "what is the fraction of values above X in a given GroupBy". Here is the solution if anyone is interested:
reviews.groupby('business_id').stars.apply(lambda x: len(x[x>3])/len(x) )