neuniversity / ALY6140

1 stars 3 forks source link

Counting problem #51

Open cloverpyy opened 5 years ago

cloverpyy commented 5 years ago

I do not know how to count the number of specific value in dataset, like calculating some probability that need the counting function, so I want to ask for it. Thanks for your help.

ThatkidfromA commented 5 years ago

Hi, Do you mean the characteristic of the data? if so, you use 'df.describe' and you can try "df.info()

shahtrupt commented 5 years ago

The below code will give you the count all the unique values in a coulmn: count = df['A'].value_counts(dropna=False)

To get the count of specific value in dataset, you can also write: count = df[df['A']=='B'].value_counts(dropna=False) I hope this helps!