deprecation warning importing pandas (python2.7 only)
See original GitHub issueCode Sample:
$mkvirtualenv pandas-deprecation-repro --python=python2.7
$workon pandas-deprecation-repro
$pip install pandas
$PYTHONWARNINGS=error::FutureWarning python -c "import pandas"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/davidchudzicki/.virtualenvs/pandas-deprecation-repro/lib/python2.7/site-packages/pandas/__init__.py", line 84, in <module>
from ._version import get_versions
File "/Users/davidchudzicki/.virtualenvs/pandas-deprecation-repro/lib/python2.7/site-packages/pandas/_version.py", line 9, in <module>
import json
File "/Users/davidchudzicki/.virtualenvs/pandas-deprecation-repro/lib/python2.7/site-packages/pandas/json.py", line 6, in <module>
"pandas.io.json instead", FutureWarning, stacklevel=2)
FutureWarning: The pandas.json module is deprecated and will be removed in a future version. Please import from pandas.io.json instead
Problem description
I help with a package that wants to run our tests with PYTHONWARNINGS=error::FutureWarning
, so that we can learn about changes in our dependencies and can avoid passing on deprecation warnings to our users. When we turn this on, import pandas
gives us an error.
It looks like _version.py
(autogenerated as part of your release process?) includes an import json
that’s interpreted (incorrectly) as referring to the old pandas.json
.
$cat /Users/davidchudzicki/.virtualenvs/pandas-deprecation-repro/lib/python2.7/site-packages/pandas/_version.py
# This file was generated by 'versioneer.py' (0.15) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.
from warnings import catch_warnings
with catch_warnings(record=True):
import json
import sys
version_json = '''
{
"dirty": false,
"error": null,
"full-revisionid": "a00154dcfe5057cb3fd86653172e74b6893e337d",
"version": "0.22.0"
}
''' # END VERSION_JSON
def get_versions():
return json.loads(version_json)
Output of pd.show_versions()
>>> import pandas as pd
>>> pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.13.final.0
python-bits: 64
OS: Darwin
OS-release: 16.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.22.0
pytest: None
pip: 9.0.1
setuptools: 38.5.1
Cython: None
numpy: 1.14.1
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2018.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Upgraded to pandas 0.13.1, getting DeprecationWarning with ...
I'm using Python 2.7.3. I just upgraded from Pandas 0.12.0 to 0.13.1, and made no other changes. I upgraded to be able to...
Read more >What's new in 1.4.0 (January 22, 2022) - Pandas
DataFrame.append() and Series.append() have been deprecated and will be removed in a future version. Use pandas.
Read more >What's New In Python 3.8 — Python 3.11.1 documentation
Many builtin and extension functions that take integer arguments will now emit a deprecation warning for Decimal s, Fraction s and any other...
Read more >Changelog - pip documentation v22.3.1
Correct deprecation warning for pip install --build to only notify when the --build value is different than the default. 1.5.3 (2014-02-20)#. DEPRECATION pip ......
Read more >NumPy 1.20.0 Release Notes
Further cleanups related to removing Python 2.7. ... It will now be checked causing a deprecation warning which will be turned into an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks like no one is working on it, feel free to take it @vitoriahmc.
Let us know if you need help getting started.
Huh. This only affects released versions.
Adding a simplefilter to that
catch_warnings
block seemed to fix things for a local version.