Skip to content

DOC: Add GroupBy.count #11025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,12 @@ def irow(self, i):
FutureWarning, stacklevel=2)
return self.nth(i)

def count(self):
""" Compute count of group, excluding missing values """

# defined here for API doc
raise NotImplementedError

def mean(self):
"""
Compute mean of groups, excluding missing values
Expand Down Expand Up @@ -2674,6 +2680,7 @@ def value_counts(self, normalize=False, sort=True, ascending=False,
return Series(out, index=mi)

def count(self):
""" Compute count of group, excluding missing values """
ids, _, ngroups = self.grouper.group_info
val = self.obj.get_values()

Expand Down Expand Up @@ -3458,6 +3465,7 @@ def _apply_to_column_groupbys(self, func):
keys=self._selected_obj.columns, axis=1)

def count(self):
""" Compute count of group, excluding missing values """
from functools import partial
from pandas.lib import count_level_2d
from pandas.core.common import _isnull_ndarraylike as isnull
Expand Down