Skip to content

raise Exception TA_OUT_OF_RANGE_END_INDEX while working with None or np.nan in f64 column #29

@786980206

Description

@786980206
import polars as pl
import polars_talib as plta
import numpy as np
(
    pl.DataFrame({"c":[1,2,3,4,5.0,None, np.nan]},strict=False)
    .select(
        plta.min(pl.col("c"),2).over("c")
    )
)

raise Exception like this:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:6                                                                                    │
│                                                                                                  │
│    3 import numpy as np                                                                          │
│    4 (                                                                                           │
│    5pl.DataFrame({"c":[1,2,3,4,5.0,None, np.nan]},strict=False)                             │
│ ❱  6 │   .select(                                                                                │
│    7 │   │   plta.min(pl.col("c"),2).over("c")                                                   │
│    8 │   )                                                                                       │
│    9 )                                                                                           │
│                                                                                                  │
│ e:\windsing\wsdata\.venv\lib\site-packages\polars\dataframe\frame.py:9854 in select              │
│                                                                                                  │
│    9851 │   │   from polars.lazyframe.opt_flags import QueryOptFlags                             │
│    9852 │   │                                                                                    │
│    9853 │   │   return (                                                                         │
│ ❱  9854 │   │   │   self.lazy()                                                                  │
│    9855 │   │   │   .select(*exprs, **named_exprs)                                               │
│    9856 │   │   │   .collect(optimizations=QueryOptFlags._eager())                               │
│    9857 │   │   )                                                                                │
│                                                                                                  │
│ e:\windsing\wsdata\.venv\lib\site-packages\polars\_utils\deprecation.py:97 in wrapper            │
│                                                                                                  │
│    94 │   │   │   │                                                                              │
│    95 │   │   │   │   del kwargs["streaming"]                                                    │
│    96 │   │   │                                                                                  │
│ ❱  97 │   │   │   return function(*args, **kwargs)                                               │
│    98 │   │                                                                                      │
│    99 │   │   wrapper.__signature__ = inspect.signature(function)  # type: ignore[attr-defined   │100 │   │   return wrapper                                                                     │
│                                                                                                  │
│ e:\windsing\wsdata\.venv\lib\site-packages\polars\lazyframe\opt_flags.py:330 in wrapper          │
│                                                                                                  │
│   327 │   │   │   │   │   optflags = cb(optflags, kwargs.pop(key))  # type: ignore[no-untyped-   │328 │   │   │                                                                                  │
│   329 │   │   │   kwargs["optimizations"] = optflags                                             │
│ ❱ 330 │   │   │   return function(*args, **kwargs)                                               │
│   331 │   │                                                                                      │
│   332 │   │   wrapper.__signature__ = inspect.signature(function)  # type: ignore[attr-defined   │333 │   │   return wrapper                                                                     │
│                                                                                                  │
│ e:\windsing\wsdata\.venv\lib\site-packages\polars\lazyframe\frame.py:2335 in collect             │
│                                                                                                  │
│   2332 │   │                                                                                     │
│   2333 │   │   # Only for testing purposes                                                       │2334 │   │   callback = _kwargs.get("post_opt_callback", callback)                             │
│ ❱ 2335 │   │   return wrap_df(ldf.collect(engine, callback))                                     │
│   2336 │                                                                                         │
│   2337 │   @overload                                                                             │
│   2338def collect_async(                                                                    │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ComputeError: the plugin failed with message: Could not compute indicator, err: TA_OUT_OF_RANGE_END_INDEX

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions