elixir-explorer / explorer

Series (one-dimensional) and dataframes (two-dimensional) for fast and elegant data exploration in Elixir
https://hexdocs.pm/explorer
MIT License
1.13k stars 123 forks source link

add json_path_match/2 #859

Closed lkarthee closed 9 months ago

lkarthee commented 9 months ago
s = Explorer.Series.from_list([~s({"a": 1}), ~s({"b": 1})])
#Explorer.Series<
  Polars[2]
  string ["{\"a\": 1}", "{\"b\": 1}"]
>
iex(3)> Explorer.Series.json_path_match(s, "$.a")
#Explorer.Series<
  Polars[2]
  string ["1", nil]
>
iex(4)> Explorer.Series.json_path_match(s, "$.")
** (RuntimeError) Polars Error: ComputeError(ErrString("error compiling JSONpath expression path error: \nEof\n"))
    (explorer 0.9.0-dev) lib/explorer/polars_backend/shared.ex:26: Explorer.PolarsBackend.Shared.apply_series/3
    iex:4: (file)
lkarthee commented 9 months ago

added docs and tests

lkarthee commented 9 months ago

random ci failure - mix format failure is due some other reason..

josevalim commented 9 months ago

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart: