A brief introduction to value_counts() and count()

一,value_counts()

(1) Usage

value_counts() is a summary calculation for different values ​​in the data of a certain column.
Example

data['dishes_name'].value_counts()

Perform summary calculations for dishes_name, and calculate the values ​​​​of different dishes in this column
insert image description here

(2) Parameter introduction

pd.value_counts(
values,
sort=True,
ascending=False,
normalize=False,
bins=None,
dropna=True,
)

parameter introduce
sort Optional True or False, the default is to sort
ascending Optional True or False, default descending order
normalize Optional True or False, whether to standardize
bins Whether to partition intervals, the default is not partitioned
dropsy Optional True or False, missing value processing

Two, count()

count() is to sum up a column to get the total number of data

data['dishes_name'].count()

It means that there are 10037 pieces of data in my column
insert image description here

Guess you like

Origin blog.csdn.net/m0_68795816/article/details/127951427