Youtube Video commentary is also available.
P-022: Count the number of unique cases for the customer ID (customer_id) of the receipt detail data frame (df_receipt).
code
len(df_receipt['customer_id'].unique())
output
8307
**-This is a method to count the number of unique rows in Pandas DataFrame / Series. -Use when you want to check how many unique lines there are in total. ** **
** * By the way, the following code is also a code that counts unique cases and outputs the same result **
code
len(df_receipt['customer_id'].value_counts())
Recommended Posts