Skip to content

API/BUG: Index.str.split(expand=True) not nan-safe #23677

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

Closed
h-vetinari opened this issue Nov 13, 2018 · 0 comments · Fixed by #23618
Closed

API/BUG: Index.str.split(expand=True) not nan-safe #23677

h-vetinari opened this issue Nov 13, 2018 · 0 comments · Fixed by #23618
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Strings String extension data type and string data
Milestone

Comments

@h-vetinari
Copy link
Contributor

This is similar to #23558 and shares the same underlying reason: #23578
Found through extensive testing introduced in #23582 (which itself is a split off from #23167)

>>> values = ['a', np.nan, 'c']
>>> pd.Series(values).str.split(' ')
0    [a]
1    NaN
2    [c]
dtype: object
>>> pd.Series(values).str.split(' ', expand=True)
     0
0    a
1  NaN
2    c
>>> pd.Index(values).str.split(' ')
Index([['a'], nan, ['c']], dtype='object')
>>> pd.Index(values).str.split(' ', expand=True)
Traceback (most recent call last):
[...]
TypeError: object of type 'float' has no len()
@gfyoung gfyoung added Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Strings String extension data type and string data labels Nov 14, 2018
@jreback jreback added this to the 0.24.0 milestone Nov 16, 2018
meiermark added a commit to meiermark/pandas that referenced this issue Nov 16, 2018
DOC Added whatsnew message for resolved issue pandas-dev#23677
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Strings String extension data type and string data
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants