Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

count number of rows pandas condition

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

pandas count rows with value

len(df[df['score'] == 1.0])
Comment

get number of rows pandas

number_of_rows = len(df)
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 :: Python Remove all occurrences of a character from a string 
Python :: mean squared error 
Python :: numpy mean 
Python :: np sum 
Python :: python print error output 
Python :: python scope 
Python :: pandas .nlargest 
Python :: django insert template in another template 
Python :: What does hexdigest do in Python? 
Python :: cumulative frequency for python dataframe 
Python :: convert list to set python 
Python :: tkinter icon 
Python :: max int python 
Python :: python to run excel macro 
Python :: python modulus 
Python :: load image metadata with pil 
Python :: get ip address python 
Python :: decode binary string python 
Python :: drop portion of string in dataframe python 
Python :: create a virtualenv python3 
Python :: python openpyxl csv to excel 
Python :: python mod function 
Python :: validate ip address 
Python :: get file size python 
Python :: max of double array python 
Python :: gzip folder python 
Python :: python get column from grouped dataframe 
Python :: Merge two data frames based on common column values in Pandas 
Python :: python binary search 
Python :: get return value from transaction in brownie 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =