cudf.core.column.string.StringMethods.get_json_object#
- StringMethods.get_json_object(json_path, *, allow_single_quotes=False, strip_quotes_from_single_strings=True, missing_fields_as_nulls=False)#
Applies a JSONPath string to an input strings column where each row in the column is a valid json string
- Parameters:
- json_pathstr
The JSONPath string to be applied to each row of the input column
- allow_single_quotesbool, default False
If True, representing strings with single quotes is allowed. If False, strings must only be represented with double quotes.
- strip_quotes_from_single_stringsbool, default True
If True, strip the quotes from the return value of a given row if it is a string. If False, values returned for a given row include quotes if they are strings.
- missing_fields_as_nullsbool, default False
If True, when an object is queried for a field it does not contain, “null” is returned. If False, when an object is queried for a field it does not contain, None is returned.
- Returns:
- Column: New strings column containing the retrieved json object strings
Examples
>>> import cudf >>> s = cudf.Series( [ \"\"\" { "store":{ "book":[ { "category":"reference", "author":"Nigel Rees", "title":"Sayings of the Century", "price":8.95 }, { "category":"fiction", "author":"Evelyn Waugh", "title":"Sword of Honour", "price":12.99 } ] } } \"\"\" ]) >>> s 0 {"store": {\n "book": [\n { "cat... dtype: object >>> s.str.get_json_object("$.store.book") 0 [\n { "category": "reference",\n ... dtype: object