fixes and docstring

This commit is contained in:
Philipp Moritz committed 2019-05-25 18:29:50 -07:00
1 parent d75b02d188
commit 465e9d4161
2 files changed
+23 -1

No files matched your search

+20
View File
@@ -153,6 +153,26 @@ cdef _get_parse_options(ParseOptions parse_options, CJSONParseOptions* out):
def read_json(input_file, read_options=None, parse_options=None,
MemoryPool memory_pool=None):
"""
Read a Table from a stream of JSON data.
Parameters
----------
input_file: string, path or file-like object
The location of JSON data.
read_options: ReadOptions, optional
Options for the JSON reader (see ReadOptions constructor for defaults)
parse_options: ParseOptions, optional
Options for the JSON parser
(see ParseOptions constructor for defaults)
memory_pool: MemoryPool, optional
Pool to allocate Table memory from
Returns
-------
:class:`pyarrow.Table`
Contents of the JSON file as a in-memory table.
"""
cdef:
shared_ptr[InputStream] stream
CJSONReadOptions c_read_options
+3 -1
View File
@@ -23,6 +23,7 @@ import pytest
import pyarrow as pa
from pyarrow.json import read_json, ReadOptions, ParseOptions
def test_read_options():
cls = ReadOptions
opts = cls()
@@ -90,7 +91,8 @@ class BaseTestCSVRead:
def test_simple_varied(self):
# Infer various kinds of data
rows = b'{"a": 1,"b": 2, "c": "3", "d": false}\n{"a": 4.0, "b": -5, "c": "foo", "d": true}\n'
rows = (b'{"a": 1,"b": 2, "c": "3", "d": false}\n'
b'{"a": 4.0, "b": -5, "c": "foo", "d": true}\n')
table = self.read_bytes(rows)
schema = pa.schema([('a', pa.float64()),
('b', pa.int64()),