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

FIX: add additional condition to check invalid type(#28277) #28319

Closed
wants to merge 3 commits into from
Closed

FIX: add additional condition to check invalid type(#28277) #28319

wants to merge 3 commits into from

Conversation

boomsquared
Copy link

@boomsquared boomsquared commented Sep 6, 2019

@pep8speaks
Copy link

pep8speaks commented Sep 6, 2019

Hello @boomsquared! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-09-06 19:31:31 UTC

@WillAyd
Copy link
Member

WillAyd commented Sep 6, 2019

Thanks for the PR! Can you add a test for the behavior you are trying to solve? Tests are typically the most critical part of any PR

@Mapichit
Copy link

Mapichit commented Sep 6, 2019

@WillAyd Thanks for the advice, will certainly do.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR! Great investigation into root cause. I'm not sure about the proposed fixed just yet but cc @TomAugspurger if he has thoughts as well

Can you also add a whatsnew note for v1.0.0?

@@ -2107,7 +2107,9 @@ def _get_series_list(self, others):
elif isinstance(others, np.ndarray) and others.ndim == 2:
others = DataFrame(others, index=idx)
return [others[x] for x in others]
elif is_list_like(others, allow_sets=False):
elif is_list_like(others, allow_sets=False) and not isinstance(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this. I think the real issue is that is_list_like returns True for s.str when it shouldn't, though I do see that is also technically Iterable so maybe this should be allowed and just fixed

@WillAyd WillAyd added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label Sep 6, 2019
@TomAugspurger
Copy link
Contributor

I'm not sold on the value of Series.str.__iter__, but #3638 and #3645 are interesting history. I'm not sure about the value of Series.str.__iter__, especially when it causes surprising behavior like this.

@WillAyd
Copy link
Member

WillAyd commented Sep 6, 2019

Hmm that's very surprising. Seems like it yields "columnar character by character" access across all elements?

Maybe we should just deprecate that behavior then? Having a hard time seeing where that is useful as an iterator

@boomsquared
Copy link
Author

boomsquared commented Sep 7, 2019

@WillAyd The StringMethods.get calls str_get which str_get "Extract element from lists, tuples, or strings in each element in the Series/Index". Should I fix the StringMethods.get by not calling str_get? I'm not sure how changing this affects the rest of the code.

@WillAyd
Copy link
Member

WillAyd commented Sep 9, 2019

I think the best approach would be to deprecate the __iter__ method of Series.str as noted above and remove in the future - is that something you'd be interested in trying?

@boomsquared
Copy link
Author

@WillAyd Is there something more to depreciating the function than just removing it from the code?

@WillAyd
Copy link
Member

WillAyd commented Sep 10, 2019

Yea we would want to throw a warning for the time being and add some doc notes / sphinx directives for the deprecation. There's a Deprecate label where you can see past PRs, but citing a specific example I think #26744 is one PR that's relatively clean to emulate

@boomsquared boomsquared deleted the fix-string-methods branch September 10, 2019 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

series.str.cat(series.str) is concatenating only the largest string
6 participants