MCPcopy
hub / github.com/pandas-dev/pandas / count

Method count

pandas/core/series.py:2072–2091  ·  view source on GitHub ↗

Return number of non-NA/null observations in the Series. Returns ------- int Number of non-null values in the Series. See Also -------- DataFrame.count : Count non-NA cells for each column or row. Examples ------

(self)

Source from the content-addressed store, hash-verified

2070
2071 # TODO: integrate bottleneck
2072 def count(self) -> int:
2073 """
2074 Return number of non-NA/null observations in the Series.
2075
2076 Returns
2077 -------
2078 int
2079 Number of non-null values in the Series.
2080
2081 See Also
2082 --------
2083 DataFrame.count : Count non-NA cells for each column or row.
2084
2085 Examples
2086 --------
2087 >>> s = pd.Series([0.0, 1.0, np.nan])
2088 >>> s.count()
2089 2
2090 """
2091 return maybe_unbox_numpy_scalar(notna(self._values).sum().astype("int64"))
2092
2093 def mode(self, dropna: bool = True) -> Series:
2094 """

Callers 15

test_series_countMethod · 0.95
is_misnamed_test_funcFunction · 0.45
is_misnamed_test_classFunction · 0.45
mainFunction · 0.45
time_countMethod · 0.45
time_multi_countMethod · 0.45
time_multi_int_countMethod · 0.45
time_groupby_sortMethod · 0.45
time_groupby_nosortMethod · 0.45

Calls 4

maybe_unbox_numpy_scalarFunction · 0.90
notnaFunction · 0.90
astypeMethod · 0.45
sumMethod · 0.45

Tested by 5

test_series_countMethod · 0.76
is_misnamed_test_funcFunction · 0.36
is_misnamed_test_classFunction · 0.36
mainFunction · 0.36