8000 ENH: #9847, adding a "same" and "expand" param to StringMethods.split() by sreejata · Pull Request #9870 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

ENH: #9847, adding a "same" and "expand" param to StringMethods.split() #9870

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
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding a future deprecation warning
  • Loading branch information
sreejata authored and sreejata committed Apr 13, 2015
commit c8f14dd23ce4b6338bb996a39721ba4babaf2c75
3 changes: 3 additions & 0 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ def str_split(arr, pat=None, n=None, return_type='series'):
if return_type in ('frame', 'expand') and isinstance(arr, Index):
raise ValueError("return_type='frame' is not supported for string "
"methods on Index")
if return_type in ('series', 'index', 'frame'):
warnings.warn(("'series', 'index' and 'frame' are deprecated. Please use 'same' or 'expand' instead"),
FutureWarning)
if pat is None:
if n is None or n == 0:
n = -1
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,6 @@ def test_str_attribute(self):
idx.str.split(return_type='frame')
with self.assertRaisesRegexp(ValueError, 'not supported'):
idx.str.split(return_type='expand')

# test boolean case, should return np.array instead of boolean Index
idx = Index(['a1', 'a2', 'b1', 'b2'])
expected = np.array([True, True, False, False])
Expand Down
0