-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Deprecate non-keyword arguments for MultiIndex.set_levels #41589
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
ENH: Deprecate non-keyword arguments for MultiIndex.set_levels #41589
Conversation
01-vyom
commented
May 20, 2021
•
edited by simonjayhawkins
Loading
edited by simonjayhawkins
- xref Deprecate non-keyword arguments in drop #41486
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
Looks like you need to tinker with stacklevels in some of the warnings |
Made all the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 test failure looks like it might be relevant, will take a closer look later
________ TestSeriesGetitemScalars.test_getitem_keyerror_with_int64index ________
[gw1] linux -- Python 3.8.10 /usr/share/miniconda/envs/pandas-dev/bin/python
self = <pandas.tests.series.indexing.test_getitem.TestSeriesGetitemScalars object at 0x7f8b6e332640>
def test_getitem_keyerror_with_int64index(self):
ser = Series(np.random.randn(6), index=[0, 0, 1, 1, 2, 2])
with pytest.raises(KeyError, match=r"^5$"):
ser[5]
with pytest.raises(KeyError, match=r"^'c'$"):
> ser["c"]
pandas/tests/series/indexing/test_getitem.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/core/series.py:945: in __getitem__
return self._get_value(key)
pandas/core/series.py:1054: in _get_value
loc = self.index.get_loc(label)
pandas/core/indexes/base.py:3356: in get_loc
return self._engine.get_loc(casted_key)
pandas/_libs/index.pyx:76: in pandas._libs.index.IndexEngine.get_loc
cpdef get_loc(self, object val):
pandas/_libs/index.pyx:103: in pandas._libs.index.IndexEngine.get_loc
return self._get_loc_duplicates(val)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> left = values.searchsorted(val, side='left')
E FutureWarning: Promotion of numbers and bools to strings is deprecated. In the future, code such as `np.concatenate((['string'], [0]))` will raise an error, while `np.asarray(['string', 0])` will return an array with `dtype=object`. To avoid the warning while retaining a string result use `dtype='U'` (or 'S'). To get an array of Python objects use `dtype=object`. (Warning added in NumPy 1.21)
EDIT
maybe not actually, been seeing that error in a few other PRs
failure is unrelated; thats the build that tests against numpy's dev branch and raises if we encounter and FutureWarnings, which we now do all over |
Thanks @01-vyom |