Skip to content

Commit

Permalink
fix some "json" capitalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed Jan 6, 2025
1 parent 7f5ff44 commit 4dc4ba4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
15 changes: 7 additions & 8 deletions py-polars/polars/expr/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,8 @@ def json_decode(
See Also
--------
json_path_match : Extract the first match of json string with provided JSONPath
expression.
json_path_match : Extract the first match from a JSON string using the provided
JSONPath.
Examples
--------
Expand All @@ -1259,19 +1259,18 @@ def json_decode(

def json_path_match(self, json_path: IntoExprColumn) -> Expr:
"""
Extract the first match of JSON string with the provided JSONPath expression.
Extract the first match from a JSON string using the provided JSONPath.
Throws errors if invalid JSON strings are encountered.
All return values will be cast to :class:`String` regardless of the original
value.
Throws errors if invalid JSON strings are encountered. All return values
are cast to :class:`String`, regardless of the original value.
Documentation on JSONPath standard can be found
Documentation on the JSONPath standard can be found
`here <https://goessner.net/articles/JsonPath/>`_.
Parameters
----------
json_path
A valid JSON path query string.
A valid JSONPath query string.
Returns
-------
Expand Down
6 changes: 3 additions & 3 deletions py-polars/polars/series/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,10 @@ def json_decode(

def json_path_match(self, json_path: IntoExprColumn) -> Series:
"""
Extract the first match of json string with provided JSONPath expression.
Extract the first match of JSON string with provided JSONPath expression.
Throw errors if encounter invalid json strings.
All return value will be cast to String regardless of the original value.
Throw errors if encounter invalid JSON strings.
All return values will be cast to String regardless of the original value.
Documentation on JSONPath standard can be found
`here <https://goessner.net/articles/JsonPath/>`_.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,8 @@ def test_json_decode_primitive_to_list_11053() -> None:
)

output = df.select(
pl.col("json").str.json_decode(schema).alias("casted_json")
).unnest("casted_json")
pl.col("json").str.json_decode(schema).alias("decoded_json")
).unnest("decoded_json")
expected = pl.DataFrame({"col1": [["123"], ["xyz"]], "col2": [["123"], None]})
assert_frame_equal(output, expected)

Expand Down

0 comments on commit 4dc4ba4

Please sign in to comment.