Repository: pandas-dev/pandas

Issue:
deprecation warning importing pandas (python2.7 only)
#### Code 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
```


Discussion:
Huh. This only affects released versions.

Adding a simplefilter to that `catch_warnings` block seemed to fix things for a local version.

```python
from warnings import catch_warnings, simplefilter
with catch_warnings(record=True):
    simplefilter('ignore', FutureWarning)
    import json
import sys

```
these are going away soon anyhow (0.24). https://github.com/pandas-dev/pandas/pull/15537
I suppose you could edit this.
Hey all - just checkin if this issue is closed? I am looking to pick something for a beginner. thank you! Is there a way to know an issue is fixed and closed?
This issue is still open, but instead of fixing the warning with the solution mentioned above (https://github.com/pandas-dev/pandas/issues/19944#issuecomment-369576892), I think we would rather just remove the `pandas.json` module entirely for the next release (but PR welcome for that as well!)
Hi there, is anyone currently working on this one? Can I get a try on this last suggestion from @jorisvandenbossche?
Looks like no one is working on it, feel free to take it @vitoriahmc.

Let us know if you need help getting started.

Resolving patch:
diff --git a/pandas/__init__.py b/pandas/__init__.py
--- a/pandas/__init__.py
+++ b/pandas/__init__.py
@@ -61,9 +61,6 @@
 # extension module deprecations
 from pandas.util._depr_module import _DeprecatedModule
 
-json = _DeprecatedModule(deprmod='pandas.json',
-                         moved={'dumps': 'pandas.io.json.dumps',
-                                'loads': 'pandas.io.json.loads'})
 parser = _DeprecatedModule(deprmod='pandas.parser',
                            removals=['na_values'],
                            moved={'CParserError': 'pandas.errors.ParserError'})
diff --git a/pandas/json.py b/pandas/json.py
deleted file mode 100644
--- a/pandas/json.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# flake8: noqa
-
-import warnings
-warnings.warn("The pandas.json module is deprecated and will be "
-              "removed in a future version. Please import from "
-              "pandas.io.json instead", FutureWarning, stacklevel=2)
-from pandas._libs.json import dumps, loads


Test patch:
diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py
--- a/pandas/tests/api/test_api.py
+++ b/pandas/tests/api/test_api.py
@@ -35,7 +35,7 @@ class TestPDApi(Base):
            'util', 'options', 'io']
 
     # these are already deprecated; awaiting removal
-    deprecated_modules = ['parser', 'json', 'lib', 'tslib']
+    deprecated_modules = ['parser', 'lib', 'tslib']
 
     # misc
     misc = ['IndexSlice', 'NaT']
@@ -173,13 +173,6 @@ def test_get_store(self):
                 s.close()
 
 
-class TestJson(object):
-
-    def test_deprecation_access_func(self):
-        with catch_warnings(record=True):
-            pd.json.dumps([])
-
-
 class TestParser(object):
 
     def test_deprecation_access_func(self):