Count distinct in Pandas aggregation
In this article, let’s see how we can count distinct in pandas aggregation. So to count the distinct in pandas aggregation we are going to use groupby() and agg() method.
- groupby(): This method is used to split the data into groups based on some criteria. Pandas objects can be split on any of their axes. We can create a grouping of categories and apply a function to the categories. The abstract definition of grouping is to provide a mapping of labels to group names
- agg(): This method is used to pass a function or list of functions to be applied on a series or even each element of series separately. In the case of a list of functions, multiple results are returned by agg() method.
Below are some examples which depict how to count distinct in Pandas aggregation:
My Personal Notes arrow_drop_up
Please Login to comment...