How much unique data is there, put it all in a table

You could use the count(distinct column) aggregation function like :

select
  count(distinct col1) as nunique_col1,
  count(distinct col2) as nunique_col2,
  count(1) as nb_rows
from database

Also in pandas, you can also apply the nunique() function on the dataset, rather than doing it on each column: df.nunique()

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top