Skip to content
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

CLN: Make repeat method consistent #24395

Merged
merged 3 commits into from
Dec 23, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
array of ints example
  • Loading branch information
jschendel committed Dec 23, 2018
commit 88ab2853eb56bcb8c595680cc33449534a84f5f6
4 changes: 2 additions & 2 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,8 @@ def factorize(self, na_sentinel=-1):
>>> cat.repeat(2)
[a, a, b, b, c, c]
Categories (3, object): [a, b, c]
>>> cat.repeat(3)
[a, a, a, b, b, b, c, c, c]
>>> cat.repeat([1, 2, 3])
[a, b, b, c, c, c]
Categories (3, object): [a, b, c]
"""

Expand Down
10 changes: 5 additions & 5 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,13 +863,13 @@ def _assert_take_fillable(self, values, indices, allow_fill=True,

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx = pd.Index(['a', 'b', 'c'])
>>> idx
Int64Index([1, 2, 3], dtype='int64')
Index(['a', 'b', 'c'], dtype='object')
>>> idx.repeat(2)
Int64Index([1, 1, 2, 2, 3, 3], dtype='int64')
>>> idx.repeat(3)
Int64Index([1, 1, 1, 2, 2, 2, 3, 3, 3], dtype='int64')
Index(['a', 'a', 'b', 'b', 'c', 'c'], dtype='object')
>>> idx.repeat([1, 2, 3])
Index(['a', 'b', 'b', 'c', 'c', 'c'], dtype='object')
"""

@Appender(_index_shared_docs['repeat'] % _index_doc_kwargs)
Expand Down
5 changes: 1 addition & 4 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,11 +1082,8 @@ def repeat(self, repeats, *args, **kwargs):
2 c
2 c
dtype: object
>>> s.repeat(3)
>>> s.repeat([1, 2, 3])
0 a
0 a
0 a
1 b
1 b
1 b
2 c
Expand Down