You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Rinke Hoekstra (Jira)" <ji...@apache.org> on 2019/11/21 15:37:00 UTC
[jira] [Updated] (ARROW-7226) [JSON][Python] Json loader fails on
example in documentation.
[ https://issues.apache.org/jira/browse/ARROW-7226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rinke Hoekstra updated ARROW-7226:
----------------------------------
Description:
I was just trying this with the example found in the pyarrow docs at [http://arrow.apache.org/docs/python/json.html]
The documented example does not work. Is this related to this issue, or is it another matter?
It says to load the following JSON file:
{{{"a": [1, 2], "b": {"c": true, "d": "1991-02-03"}}}}
{{{"a": [3, 4, 5], "b": {"c": false, "d": "2019-04-01"}}}}
I fixed this to make it valid JSON (It is valid [JSON Lines|[http://jsonlines.org/]], but that's another issue):
{{[{"a": [1, 2], "b": {"c": true, "d": "1991-02-03"}},}}
{{{"a": [3, 4, 5], "b": {"c": false, "d": "2019-04-01"}}]}}
Then reading the JSON from a file called `my_data.json`:
{{from pyarrow import json}}
{{table = json.read_json("my_data.json")}}
Gives the following error:
{code:java}
---------------------------------------------------------------------------}}
ArrowInvalid Traceback (most recent call last)
<ipython-input-69-f974c21f0941> in <module>()
1 from pyarrow import json
----> 2 table = json.read_json('test.json')
~/.local/share/virtualenvs/parquet-ifRxINoC/lib/python3.7/site-packages/pyarrow/_json.pyx in pyarrow._json.read_json()
~/.local/share/virtualenvs/parquet-ifRxINoC/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status()
ArrowInvalid: JSON parse error: A column changed from object to array
{code}
was:
I was just trying this with the example found in the pyarrow docs at [http://arrow.apache.org/docs/python/json.html]
The documented example does not work. Is this related to this issue, or is it another matter?
It says to load the following JSON file:
{{{"a": [1, 2], "b": {"c": true, "d": "1991-02-03"}}}}
{{{"a": [3, 4, 5], "b": {"c": false, "d": "2019-04-01"}}}}
I fixed this to make it valid (but that's another issue):
{{[{"a": [1, 2], "b": {"c": true, "d": "1991-02-03"}},}}
{{{"a": [3, 4, 5], "b": {"c": false, "d": "2019-04-01"}}]}}
Then reading the JSON from a file called `my_data.json`:
{{from pyarrow import json}}
{{table = json.read_json("my_data.json")}}
Gives the following error:
{code:java}
---------------------------------------------------------------------------}}
ArrowInvalid Traceback (most recent call last)
<ipython-input-69-f974c21f0941> in <module>()
1 from pyarrow import json
----> 2 table = json.read_json('test.json')
~/.local/share/virtualenvs/parquet-ifRxINoC/lib/python3.7/site-packages/pyarrow/_json.pyx in pyarrow._json.read_json()
~/.local/share/virtualenvs/parquet-ifRxINoC/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status()
ArrowInvalid: JSON parse error: A column changed from object to array
{code}
Summary: [JSON][Python] Json loader fails on example in documentation. (was: [JSON] Json loader fails on example in documentation.)
> [JSON][Python] Json loader fails on example in documentation.
> -------------------------------------------------------------
>
> Key: ARROW-7226
> URL: https://issues.apache.org/jira/browse/ARROW-7226
> Project: Apache Arrow
> Issue Type: Bug
> Reporter: Rinke Hoekstra
> Priority: Major
>
> I was just trying this with the example found in the pyarrow docs at [http://arrow.apache.org/docs/python/json.html]
> The documented example does not work. Is this related to this issue, or is it another matter?
> It says to load the following JSON file:
> {{{"a": [1, 2], "b": {"c": true, "d": "1991-02-03"}}}}
> {{{"a": [3, 4, 5], "b": {"c": false, "d": "2019-04-01"}}}}
> I fixed this to make it valid JSON (It is valid [JSON Lines|[http://jsonlines.org/]], but that's another issue):
> {{[{"a": [1, 2], "b": {"c": true, "d": "1991-02-03"}},}}
> {{{"a": [3, 4, 5], "b": {"c": false, "d": "2019-04-01"}}]}}
> Then reading the JSON from a file called `my_data.json`:
> {{from pyarrow import json}}
> {{table = json.read_json("my_data.json")}}
> Gives the following error:
> {code:java}
> ---------------------------------------------------------------------------}}
> ArrowInvalid Traceback (most recent call last)
> <ipython-input-69-f974c21f0941> in <module>()
> 1 from pyarrow import json
> ----> 2 table = json.read_json('test.json')
> ~/.local/share/virtualenvs/parquet-ifRxINoC/lib/python3.7/site-packages/pyarrow/_json.pyx in pyarrow._json.read_json()
> ~/.local/share/virtualenvs/parquet-ifRxINoC/lib/python3.7/site-packages/pyarrow/error.pxi in pyarrow.lib.check_status()
> ArrowInvalid: JSON parse error: A column changed from object to array
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)