FIX: add additional condition to check invalid type(#28277)
- [ ] closes #28277
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Hello @boomsquared! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:





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

##### Comment last updated at 2019-09-06 19:31:31 UTC 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 @WillAyd Thanks for the advice, will certainly do.  I'm not sold on the value of `Series.str.__iter__`, but https://github.com/pandas-dev/pandas/issues/3638 and https://github.com/pandas-dev/pandas/pull/3645 are interesting history. I'm not sure about the value of `Series.str.__iter__`, especially when it causes surprising behavior like this.  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 @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. 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? @WillAyd Is there something more to depreciating the function than just removing it from the code? 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