当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


Python cudf.core.column.string.StringMethods.get_json_object用法及代码示例

用法:

StringMethods.get_json_object(json_path)

将 JSONPath 字符串应用于输入字符串列,其中列中的每一行都是有效的 json 字符串

参数

json_path: str

要应用于输入列的每一行的 JSONPath 字符串

返回

Column:包含检索到的 json 对象字符串的新字符串列

例子

>>> 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

相关用法


注:本文由纯净天空筛选整理自rapids.ai大神的英文原创作品 cudf.core.column.string.StringMethods.get_json_object。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。