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

BUG: step argument in the slice StringMethod not working #8754

Closed
jorisvandenbossche opened this issue Nov 8, 2014 · 0 comments · Fixed by #8843
Closed

BUG: step argument in the slice StringMethod not working #8754

jorisvandenbossche opened this issue Nov 8, 2014 · 0 comments · Fixed by #8843
Labels
Bug Strings String extension data type and string data
Milestone

Comments

@jorisvandenbossche
Copy link
Member

The step argument in the slice StringMethods has no effect:

In [18]: s = pd.Series(['abcde', 'fghij'])

In [19]: s.str.slice?
Definition:  s.str.slice(self, start=None, stop=None, step=1)
Slice substrings from each element in array

Parameters
----------
start : int or None
stop : int or None

Returns
-------
sliced : array

In [22]: s.str.slice(step=1)
Out[22]: 
0    abcde
1    fghij
dtype: object

In [23]: s.str.slice(step=2)
Out[23]: 
0    abcde
1    fghij
dtype: object

In [24]: s[0][::2]
Out[24]: 'ace'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Strings String extension data type and string data
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants