Home>
I implemented a function to count the number of data with reference to the Internet.
df = pd.DataFrame ({'class': ['a', 'a', 'a', 'b', 'b', 'c'], 'score': [0,20,10,1,3,21]})
print (df)
# class score
# 0 a 0
# 1 a 20
# 2 a 10
# 3 b 1
# 4 b 3
# 5 c 21
print (df.groupby ('class'). count ())
# score
#class
#a 3
#b 2
#c 1
Implementation was successful like this.
However, I wanted to extract the number of data and tried it variously, but it was not successful.

Answer # 1
Related articles
 python 3x  how to count the number of data extracted by pandas or how to solve the error
 python  how to count the number of characters in a character string including a regular expression
 python  i want to find the number of data per row in pandas dataframe
 python  count by element with pivot_table in pandas
 google analytics  i want to count the number of accesses by data on the google site
 how to count days of the week python
 python  randomly extract data from multiple data frames (no between data frames is the same)
 count the number of types of c language array elements
 how do i merge dataframes inside a python pandas function?
 where is the minor version number of python that starts by default specified?
 python 3x  the reading of the expression in the excel file in pandas becomes nan
 python  about pandas, gspread
 i want to count the number of keystrokes in java and make a conditional branch
 python  i can't understand the specifications of pandas
 python pandas pivot_table is not reflected
 python  when you want to judge by the number of characters from the back with a regular expression
 python  valueerror: field'id' expected a number but got'suzukitadashi'
 python  how to load multiple time formats with pandas
 python  how to count url clicks in django and record them in the db
 python  how to accept number input even if keypressevent is defined for qlineedit in pyside
Related questions
 python : Find the number of weeks in the quarter and month
 python : How to create other columns with binary signs by value from the speaker?
 python : How to make a normal output?
 python : Using Apply in Pandas
 python : NUMPY Installation Error
 python : Calculate the number of values in the Dataprama column
 python : Why is if inside the function not working correctly?
 python : VWAP calculation, ends with RAM, the code is performed too long
 python : How to rescue from the site specific data?
 Python How to create a 2D array of DataFrame?
You can get the number of rows, the number of columns and the number of data in the data frame as follows.
Is it the number of unique data types?