ENH: simple patch for read_json compression
State: closed

Addresses GH15644

 - [x] closes #15644
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff``
 - [x] whatsnew entry

The latest comment on https://github.com/pandas-dev/pandas/issues/15644 from March suggest just adding compression to read_json. This does that.

Not sure what kind of tests should be added since its using pre-existing code. It works when I tested it manually, and test_fast.sh returned with:
>9880 passed, 1280 skipped, 6 xfailed in 145.52 seconds

This is my first contribution, and I'm a bit confused about the whatsnew entry. I'm not sure which version the changes should be recorded in.

In that vein,``git diff upstream/master --name-only -- '*.py' | flake8 --diff`` fails with:
>fatal: bad revision 'upstream/master'

Labels:
name: IO Data
description: IO issues that don't fit into a more specific label
name: IO JSON
description: read_json, to_json, json_normalize

Comments:
> I'm not sure which version the changes should be recorded in.

New feature, so it can go in `whatsnew/v0.21.0.txt`

> In that vein,git diff upstream/master --name-only -- '*.py' | flake8 --diff fails with:

What's the output of `git remote -v`? That should include a couple lines like

```
upstream	https://github.com/pandas-dev/pandas (fetch)
upstream	https://github.com/pandas-dev/pandas (push)
```

but it may be named differently.
@TomAugspurger:

>What's the output of git remote -v? That should include a couple lines like
```
$ git remote -v
origin	git@github.com:colinhiggins/pandas.git (fetch)
origin	git@github.com:colinhiggins/pandas.git (push)
```
I tried a few different forms, all failed with the same error, including:
https://github.com/pandas-dev/pandas
git@github.com:pandas-dev/pandas.git
git://github.com/pandas-dev/pandas

git remote add upstream https://github.com/pandas-dev/pandas should; then
you'll need to `git fetch upstream` before it'll work.

On Wed, Jun 21, 2017 at 1:37 PM, colinhiggins <notifications@github.com>
wrote:

> @TomAugspurger <https://github.com/tomaugspurger>:
>
> What's the output of git remote -v? That should include a couple lines like
>
> $ git remote -v
> origin	git@github.com:colinhiggins/pandas.git (fetch)
> origin	git@github.com:colinhiggins/pandas.git (push)
>
> I tried a few different forms, all failed with the same error, including:
> https://github.com/pandas-dev/pandas
> git@github.com:pandas-dev/pandas.git
> git://github.com/pandas-dev/pandas
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/16750#issuecomment-310168065>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABQHIv9Xdh2gkVItDlLIY8ibza7-MsO0ks5sGWMAgaJpZM4OBSwm>
> .
>

Ah, right, duh. It ran with no output. Is that a pass?
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16750?src=pr&el=h1) Report
> Merging [#16750](https://codecov.io/gh/pandas-dev/pandas/pull/16750?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/8a98f5ed541c87a9bf101c9331bd6cfa8f007cc9?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16750/graphs/tree.svg?height=150&src=pr&token=eZ4WkYLtcO&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/16750?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #16750   +/-   ##
=======================================
  Coverage   90.93%   90.93%           
=======================================
  Files         161      161           
  Lines       49282    49282           
=======================================
  Hits        44816    44816           
  Misses       4466     4466
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.7% <ø> (ø)` | :arrow_up: |
| #single | `40.17% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16750?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/json/json.py](https://codecov.io/gh/pandas-dev/pandas/pull/16750?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vanNvbi5weQ==) | `100% <ø> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16750?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16750?src=pr&el=footer). Last update [8a98f5e...12b6012](https://codecov.io/gh/pandas-dev/pandas/pull/16750?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Reverted back to the `path_or_buf` API to maintain backward compatibility, added the whatsnew blurb, and fixed an indentation PEP8 violation.
Changes look good, but we'll need tests for the new behavior.

You can compress https://github.com/pandas-dev/pandas/blob/master/pandas/tests/io/json/data/tsframe_iso_v012.json and add it to the repo, and then ensure we have basic coverage on this. We should also have a jsonlines version too probably.
see https://github.com/pandas-dev/pandas/pull/13317 for how to do tests on this.

This needs similar types of testing.
Got it. I can take a crack at the to_json and tests, but it will have to wait for the weekend.
closing this. it needs comprehensive tests as indicated above. pls comment if you'd like to reopen.