-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: string methods with NA #31684
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: string methods with NA #31684
Conversation
Have added |
I don’t think we want is_nan to recognize NA. |
Agreed. To fix #31632 we'll likely want to adjust how the |
thanks for the inputs...will update this PR or raise a new one |
@TomAugspurger I think |
Either of those sound sensible.
…On Wed, Feb 5, 2020 at 10:51 PM Prakhar Pandey ***@***.***> wrote:
@TomAugspurger <https://github.com/TomAugspurger> I think vec_binop is
called instead of na_map because input is a vector. Should we implement a
variant of vec_binop which can handle NA? Or a shorter fix might be
checking for NA before calling bytes.__mul__ and str.__mul__
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#31684?email_source=notifications&email_token=AAKAOIS2IMDWKD53WV5ZOC3RBOJNBA5CNFSM4KQFW7K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEK55RWQ#issuecomment-582736090>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKAOIVMIKLXCXMXQPNSXY3RBOJNBANCNFSM4KQFW7KQ>
.
|
2be31fa
to
7d5e4f8
Compare
pandas/core/strings.py
Outdated
@@ -778,6 +778,8 @@ def scalar_rep(x): | |||
else: | |||
|
|||
def rep(x, r): | |||
if isinstance(x, libmissing.NAType): |
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.
do we need the same change for scalar_rep? (and a test that hits it)?
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.
If sequence passed to repeat has None it is handled...have added a test for it
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.
instead of isinstance, just use if x is NA
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.
Thanks for the suggestion. Have updated.
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.
can you add pd.NA in tests for the other string methods, this might be a more systematic issue.
@jreback |
@jreback should i put the pd.NA tests in separate function or just add to functions that are already there? |
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.
can you add pd.NA in tests for the other string methods, this might be a more systematic issue.
@jreback this was the only case method using vec_binop
. The rest are using _na_map
which should handle NA correctly. So I think we're OK.
Thanks @prakhar987!
@meeseeksdev backport to 1.0.x |
Something went wrong ... Please have a look at my logs. |
Co-authored-by: Prakhar Pandey <[email protected]>
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff