8000 Rename signature fix by TomAugspurger · Pull Request #17966 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Rename signature fix #17966

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

Merged
merged 13 commits into from
Oct 27, 2017
Prev Previous commit
Next Next commit
Fixed error message
  • Loading branch information
TomAugspurger committed Oct 26, 2017
commit 1c1517ac968b0aeab71a553f2a8540a6e4552581
7 changes: 4 additions & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2818,7 +2818,7 @@ def _validate_axis_style_args(self, args, kwargs, arg_name, method_name):

# Start by validating for consistency
if 'axis' in kwargs and any(x in kwargs for x in self._AXIS_NUMBERS):
msg = "Cannot specify both 'axis' and any of 'columns' or 'index'."
msg = "Cannot specify both 'axis' and any of 'index' or 'columns'."
raise TypeError(msg)

# First fill with explicit values provided by the user...
Expand Down Expand Up @@ -2852,8 +2852,9 @@ def _validate_axis_style_args(self, args, kwargs, arg_name, method_name):
elif len(args) == 2:
if 'axis' in kwargs:
# Unambiguously wrong
msg = "Cannot specify both {} and any of 'index' or 'columns'"
raise TypeError(msg.format(arg_name))
msg = ("Cannot specify both 'axis' and any of 'index' "
"or 'columns'")
raise TypeError(msg)

msg = ("Intepreting call\n\t'.{method_name}(a, b)' as "
"\n\t'.{method_name}(index=a, columns=b)'.\nUse named "
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/frame/test_axis_select_reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,10 @@ def test_reindex_positional_warns(self):
def test_reindex_axis_style_raises(self):
# https://github.com/pandas-dev/pandas/issues/12392
df = pd.DataFrame({"A": [1, 2, 3], 'B': [4, 5, 6]})
with tm.assert_raises_regex(TypeError, 'Cannot 560F specify both labels'):
with tm.assert_raises_regex(TypeError, "Cannot specify both 'axis'"):
df.reindex([0, 1], ['A'], axis=1)

with tm.assert_raises_regex(TypeError, 'Cannot specify both labels'):
with tm.assert_raises_regex(TypeError, "Cannot specify both 'axis'"):
df.reindex([0, 1], ['A'], axis='index')

with tm.assert_raises_regex(TypeError, "Cannot specify both 'axis'"):
Expand Down
0