Home > Software design >  How can I find the number of my dataset based on a certain value of the new dataset I created from t
How can I find the number of my dataset based on a certain value of the new dataset I created from t

Time:10-28

Here is the my new dataframe.value_counts() and i want to reach how many No and Yes for Canberra data_ How can i learn this

Location      RainTomorrow
Canberra      No              937
Woomera       No              932
AliceSprings  No              931
Mildura       No              888
Cobar         No              861
                             ... 
Katherine     Yes              87
Nhil          Yes              84
AliceSprings  Yes              80
Woomera       Yes              66
Uluru         Yes              27
Length: 98, dtype: int64

CodePudding user response:

Try filtering with loc and value_counts():

df.loc[df.Location == 'Canberra'].RainTomorrow.value_counts()
  • Related