Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

count number of rows pandas condition

sum(df['sex'] == 'man')
Comment

pandas count number of rows with value

In [37]:
df = pd.DataFrame({'a':list('abssbab')})
df.groupby('a').count()

Out[37]:

   a
a   
a  2
b  3
s  2

[3 rows x 1 columns]
Comment

PREVIOUS NEXT
Code Example
Python :: # list all keywords in Python 
Python :: triangle pattern in python 
Python :: print zip object python 
Python :: django httpresponseredirect 
Python :: max int value in python 
Python :: how to say hello with name in python 
Python :: Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory. 
Python :: convert list to string python 
Python :: pandas drop column by index range 
Python :: flip specific bit python 
Python :: converting bool to 1 if it has true and if it is false print 1 
Python :: python program to give shop name 
Python :: remove duplicate space in string in pytoon 
Python :: django email settings 
Python :: find two number in python 
Python :: python for i in directory 
Python :: kaaba python tutorial 
Python :: exact distance 
Python :: selenium text returns empty string python 
Python :: read excel sheet in python 
Python :: create folder python 
Python :: the user to enter their name and display each letter in their name on a separate line python 
Python :: dictionary in python does not support append operation 
Python :: pandas from series to dataframe 
Python :: how to get the location of the cursor screen in python 
Python :: how to stop running code in python 
Python :: how to make game on python 
Python :: np range data 
Python :: python send email outlook 
Python :: show all rows with nan for a column value pandas 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =