yeandy commented on a change in pull request #16677:
URL: https://github.com/apache/beam/pull/16677#discussion_r819033053
##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -4721,13 +4721,91 @@ def repeat(self, repeats):
pd.core.strings.StringMethods, 'get_dummies',
reason='non-deferred-columns')
- split = frame_base.wont_implement_method(
- pd.core.strings.StringMethods, 'split',
- reason='non-deferred-columns')
+ def _split_helper(
+ self, rsplit=False, pat=None, expand=False, regex=None, **kwargs):
+
+ # Adding arguments to kwargs. regex introduced in pandas 1.4
+ # but only for split, not rsplit
+ kwargs['pat'] = pat
+ kwargs['expand'] = expand
+ if PD_VERSION >= (1, 4) and not rsplit:
+ kwargs['regex'] = regex
Review comment:
I need to utilize all the args for branching logic, so it seems to be
equally clean/unclean. I can simply the function definition, and pretty much do
the reverse with the logic. Do you think this is syntactically better?
```
pat = kwargs.get('pat', None)
expand = kwargs.get('expand', False)
regex = kwargs.get('regex', None)
if PD_VERSION < (1, 4) and not rsplit:
kwargs.pop('regex', None)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]