-
Notifications
You must be signed in to change notification settings - Fork 590
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
ENH/BUG: Support string slicing with other expressions #1627
Conversation
801b858
to
054f5b0
Compare
|
@kszucs Can you give this a review when you get a chance? |
ibis/expr/api.py
Outdated
| raise ValueError('negative slicing not yet supported') | ||
| if not isinstance(stop, ir.Expr): | ||
| if stop is not None and stop < 0: | ||
| raise ValueError('negative slicing not yet supported') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uppercase n
ibis/expr/api.py
Outdated
| if stop is not None and stop < 0: | ||
| raise ValueError('negative slicing not yet supported') | ||
| if stop is None: | ||
| stop = self.length() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, just not consistent with the previous validation order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow, what was the previous validation order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is None goes to the top + elif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, nevermind, I see it
ibis/pandas/execution/strings.py
Outdated
| def execute_string_substring_series_series(op, data, start, length, **kwargs): | ||
| end = start + length | ||
|
|
||
| def iterate(value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "general" case wouldn't be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could farm out the other functions to this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely need to handle the integer, series and series, integer cases distinctly, but those two can be made to be instances of the general case.
ibis/expr/api.py
Outdated
| if start is None: | ||
| start = 0 | ||
| if start < 0: | ||
| raise ValueError('Negative slicing not yet supported') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps self.length() + start?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crossed out because of this comment.
b562d92
to
c8a8867
Compare
c8a8867
to
2494069
Compare
|
Merging on green |
Closes #1626