Skip to content

Commit

Permalink
DOC: edit docstring example to prevent segfault (pandas-dev#21824) (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche authored and Moons08 committed Aug 17, 2018
1 parent effe310 commit 8b13327
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6896,21 +6896,21 @@ def count(self, axis=0, level=None, numeric_only=False):
Constructing DataFrame from a dictionary:
>>> df = pd.DataFrame({"Person":
... ["John", "Myla", None, "John", "Myla"],
... ["John", "Myla", "Lewis", "John", "Myla"],
... "Age": [24., np.nan, 21., 33, 26],
... "Single": [False, True, True, True, False]})
>>> df
Person Age Single
0 John 24.0 False
1 Myla NaN True
2 None 21.0 True
2 Lewis 21.0 True
3 John 33.0 True
4 Myla 26.0 False
Notice the uncounted NA values:
>>> df.count()
Person 4
Person 5
Age 4
Single 5
dtype: int64
Expand All @@ -6920,7 +6920,7 @@ def count(self, axis=0, level=None, numeric_only=False):
>>> df.count(axis='columns')
0 3
1 2
2 2
2 3
3 3
4 3
dtype: int64
Expand All @@ -6931,7 +6931,9 @@ def count(self, axis=0, level=None, numeric_only=False):
Age
Person
John 2
Lewis 1
Myla 1
"""
axis = self._get_axis_number(axis)
if level is not None:
Expand Down

0 comments on commit 8b13327

Please sign in to comment.