0

I want to get count of value 10 in a particular column of dataframe.

 df:

    A    B

    a    10
    b    20
    c    10

I want simply count of 10 in column B , here it is 2.

Saketh Katari
  • 332
  • 2
  • 11
KMittal
  • 602
  • 1
  • 7
  • 21
  • 2
    Use `out = df['B'].eq(10).sum()` – jezrael Sep 06 '18 at 13:00
  • in case I want to use > 10 then ? – KMittal Sep 06 '18 at 13:14
  • 1
    then use `out = df['B'].gt(10).sum()` – jezrael Sep 06 '18 at 13:14
  • 1
    [`lt`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.lt.html) [`gt`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.gt.html) [`le`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.le.html) [`ge`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.ge.html) [`ne`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.ne.html) [`eq`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.eq.html) – jezrael Sep 06 '18 at 13:15
  • 1
    `<` `>` `<=` `>=` `!=` `==` – jezrael Sep 06 '18 at 13:15

0 Answers0