Skip to content

Commit

Permalink
Merge pull request #11823 from rapidsai/branch-22.10
Browse files Browse the repository at this point in the history
[gpuCI] Forward-merge branch-22.10 to branch-22.12 [skip gpuci]
  • Loading branch information
GPUtester authored Sep 29, 2022
2 parents 87d0387 + 4023b65 commit 0ecbaa1
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion python/cudf/cudf/utils/ioutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,30 @@
a b
0 "hello" "hello"
1 "rapids" "worlds"
"""
Reading a JSON string containing ordered lists and name/value pairs:
>>> json_str = '[{"list": [0,1,2], "struct": {"k":"v1"}}, {"list": [3,4,5], "struct": {"k":"v2"}}]'
>>> cudf.read_json(json_str, engine='cudf_experimental')
list struct
0 [0, 1, 2] {'k': 'v1'}
1 [3, 4, 5] {'k': 'v2'}
Reading JSON Lines data containing ordered lists and name/value pairs:
>>> json_str = '{"a": [{"k1": "v1"}]}\n{"a": [{"k1":"v2"}]}'
>>> cudf.read_json(json_str, engine='cudf_experimental', lines=True)
a
0 [{'k1': 'v1'}]
1 [{'k1': 'v2'}]
Using the `dtype` argument to specify type casting:
>>> json_str = '{"k1": 1, "k2":[1.5]}'
>>> cudf.read_json(json_str, engine='cudf_experimental', lines=True, dtype={'k1':float, 'k2':cudf.ListDtype(int)})
k1 k2
0 1.0 [1]
""" # noqa: E501
doc_read_json = docfmt_partial(docstring=_docstring_read_json)

_docstring_to_json = """
Expand Down

0 comments on commit 0ecbaa1

Please sign in to comment.