Issue
I am having trouble creating a count of screen_size values above 6 inches for each brand_name.
The data:
My code thus far:
df.loc[df["screen_size"]>=6.0]
Solution
Try:
df.loc[df["screen_size"]>=6.0,"brand_name"].value_counts()
(i) df.loc[df["screen_size"]>=6.0,"brand_name"]
is a pandas Series that consists of the rows of the brand_name
column where the corresponding screen_size>=6
(ii) value_counts()
method counts each brand_name
in that pandas Series.
Answered By - NewbieAF
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.