Skip to content

Fix undefined meta for str.split(expand=False)#5022

Merged
TomAugspurger merged 1 commit intodask:masterfrom
bnaul:patch-2
Jun 28, 2019
Merged

Fix undefined meta for str.split(expand=False)#5022
TomAugspurger merged 1 commit intodask:masterfrom
bnaul:patch-2

Conversation

@bnaul
Copy link
Copy Markdown
Contributor

@bnaul bnaul commented Jun 28, 2019

Looks like this got broken in #4744.

Copy link
Copy Markdown
Member

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Strange that flake8 doesn't catch this. Thanks!

Copy link
Copy Markdown
Member

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Actually, one small request to preserve the name.

meta = type(self._series._meta)([" ".join(["a"] * 2 * n)])
meta = meta.str.split(n=n, expand=expand, pat=pat)
else:
meta = list
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, actually, can you try meta = (self._series.name, list) here? Will that work?

Right now we're dropping Series.name, if it has one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

list didn't work but object did 👍



def test_str_noexpand():
s = pd.Series(["a b c d", "aa bb cc dd", "aaa bbb ccc dddd"])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add name='foo' here too? Ensure that it stays.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@TomAugspurger TomAugspurger merged commit a2f7334 into dask:master Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants