3
I have a base with a column custumer_id
and I need to know the amount of unique records on the base.
quantidade_clientes = df[['customer_id']]
quantidade_clientes.count()
This way I count everyone, I want to know only who is unique.
3
I have a base with a column custumer_id
and I need to know the amount of unique records on the base.
quantidade_clientes = df[['customer_id']]
quantidade_clientes.count()
This way I count everyone, I want to know only who is unique.
3
The pandas has the function .nunique()
, which returns the amount of unique values in a Data Frame or a Series. In your case, just do:
df['customer_id'].nunique()
Browser other questions tagged python pandas
You are not signed in. Login or sign up in order to post.