Skip to content
Advertisement

How can I use value_counts() only for certain values?

I want to extract how many positive reviews by brand are in a dataset which includes reviews from thousands of products. I used this code and I got a table including percentaje of positive and non-positive reviews. How can I get only the percentage of positive reviews by brand? I only want the “True” results in positive_review. Thanks!

JavaScript

Advertisement

Answer

You can unstack the output and slice the True

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement