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

DataFrame.summarise(a: product(a)) broken #982

Closed scvalex closed 2 months ago

scvalex commented 2 months ago

Livebook 0.14.0, Explorer 0.9.2

If you try to summarise a column by suming it, everything works fine. But if you try to do this with product, you get an error.

Running:

require Explorer.DataFrame, as: DF
require Explorer.Series, as: S

df =
  [%{a: 10}, %{a: 20}, %{a: 30}]
  |> DF.new()

df
|> DF.summarise(a: sum(a))

Gives the expected result:

#Explorer.DataFrame<
  Polars[1 x 1]
  a s64 [60]
>

But running the same with product:

df
|> DF.summarise(a: product(a))

Gives this error:

** (RuntimeError) cannot perform at/2 operation on Explorer.Backend.LazySeries. Query operations work on lazy series and those support only a subset of series operations
    (explorer 0.9.2) lib/explorer/backend/lazy_series.ex:1260: Explorer.Backend.LazySeries.at/2
    #cell:kk2mnlwyvlbn2sbo:9: (file)
    #cell:kk2mnlwyvlbn2sbo:9: (file)
philss commented 2 months ago

@scvalex thank for the report! This is fixed on main.

scvalex commented 2 months ago

Thank you!