-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
multi-dimensional-indexing deprecation warning has inconsistent stack level. #31479
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
Comments
Yes, the problem here is that the place where the warning is raised can be reached in different ways (and so potentially needing a different stacklevel). Such a "dynamic stack-level inferring" sounds interesting. Your experience with it in matplotlib is good? It has proven robust? |
We now have pandas.util._exceptions.find_stack_level doing pretty much exactly what matplotlib's _warn_external does. I've been trying to use the "cheat" sparingly, but if its needed, this is now an easy fix. |
answering 17month later, we have not had any reported issues with it! |
Code Sample, a copy-pastable example if possible
Problem description
Running the above script gives:
I think the issue is that
pandas/pandas/core/indexers.py
Lines 263 to 270 in 7d616b9
Expected Output
pandas should be the module reported in the warning about slicing in both cases or neither case. You may want to use something like https://github.com/matplotlib/matplotlib/blob/e4dbf4e7b5241e7d74f79adc854f84a954b45e8f/lib/matplotlib/cbook/__init__.py#L2013-L2032 to find the first stack not in pandas to put the warning at.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Linux
OS-release : 5.0.0-38-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.0rc0
numpy : 1.16.5
pytz : 2019.2
dateutil : 2.8.0
pip : 19.2.2
setuptools : 41.0.1
Cython : 0.29.13
pytest : 3.10.1
hypothesis : None
sphinx : 2.2.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.12.0.dev
pandas_datareader: None
bs4 : 4.8.2
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.2.0rc2.post1219+g3d8a6cb83
numexpr : 2.7.0
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 3.10.1
s3fs : None
scipy : 1.3.1
sqlalchemy : None
tables : 3.6.1
tabulate : None
xarray : 0.14.0
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: