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.12k stars 123 forks source link

qcut error 'quantiles are not unique while allow_duplicates=False' #1006

Closed petrkozorezov closed 4 weeks ago

petrkozorezov commented 1 month ago

It's impossible to calculate quantiles when there are duplicates.

Explorer.Series.from_list([0.0, 0.0, 0.0, 3.0, 4.0, 5.0])
|> Explorer.Series.qcut([0.1, 0.25, 0.75])
** (RuntimeError) Polars Error: duplicate: quantiles are not unique while allow_duplicates=False
    (explorer 0.9.2) lib/explorer/polars_backend/shared.ex:18: Explorer.PolarsBackend.Shared.apply/2
    (explorer 0.9.2) lib/explorer/polars_backend/series.ex:549: Explorer.PolarsBackend.Series.qcut/5
    #cell:tug3ltfjbo7jbnjh:2: (file)
philss commented 1 month ago

There is an option that we need to expose. I will fix that soon. Thanks for the report!