We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
According to the API the following should index from the first value to the end of the array, but instead raises a ComputeError exception
import polars as pl vals = [[1, 2, 3, 4], [10, 2, 1]] s = pl.Series("a", vals) s.arr.slice(1) --------------------------------------------------------------------------- ComputeError Traceback (most recent call last) Cell In[13], line 3 1 vals = [[1, 2, 3, 4], [10, 2, 1]] 2 s = pl.Series("a", vals) ----> 3 s.arr.slice(1) File /usr/local/lib/python3.10/site-packages/polars/internals/series/utils.py:98, in call_expr.<locals>.wrapper(self, *args, **kwargs) 96 expr = getattr(expr, namespace) 97 f = getattr(expr, func.__name__) ---> 98 return s.to_frame().select(f(*args, **kwargs)).to_series() File /usr/local/lib/python3.10/site-packages/polars/internals/dataframe/frame.py:5620, in DataFrame.select(self, exprs) 5524 def select( 5525 self: DF, 5526 exprs: str (...) 5529 | Sequence[str | pli.Expr | pli.Series | pli.WhenThen | pli.WhenThenThen], 5530 ) -> DF: 5531 """ 5532 Select columns from this DataFrame. 5533 (...) 5617 5618 """ 5619 return self._from_pydf( -> 5620 self.lazy().select(exprs).collect(no_optimization=True)._df 5621 ) File /usr/local/lib/python3.10/site-packages/polars/utils.py:329, in deprecated_alias.<locals>.deco.<locals>.wrapper(*args, **kwargs) 326 @functools.wraps(fn) 327 def wrapper(*args: P.args, **kwargs: P.kwargs) -> T: 328 _rename_kwargs(fn.__name__, kwargs, aliases) --> 329 return fn(*args, **kwargs) File /usr/local/lib/python3.10/site-packages/polars/internals/lazyframe/frame.py:1168, in LazyFrame.collect(self, type_coercion, predicate_pushdown, projection_pushdown, simplify_expression, no_optimization, slice_pushdown, common_subplan_elimination, streaming) 1157 common_subplan_elimination = False 1159 ldf = self._ldf.optimization_toggle( 1160 type_coercion, 1161 predicate_pushdown, (...) 1166 streaming, 1167 ) -> 1168 return pli.wrap_df(ldf.collect()) ComputeError: could not extract number from AnyValue of dtype: 'Unknown'
Slices to end of the array
---Version info--- Polars: 0.15.7 Index type: UInt32 Platform: Linux-5.10.104-linuxkit-x86_64-with-glibc2.28 Python: 3.10.1 (main, Dec 21 2021, 09:50:13) [GCC 8.3.0] ---Optional dependencies--- pyarrow: 10.0.1 pandas: 1.5.2 numpy: 1.23.5 fsspec: <not installed> connectorx: 0.3.1 xlsx2csv: 0.8 matplotlib: 3.6.2
The text was updated successfully, but these errors were encountered:
I also see this issue on 0.14.31. This workaround appears to fix the issue for now....
import polars as pl vals = [[1, 2, 3, 4], [10, 2, 1]] s = pl.Series("a", vals) s.arr.slice(1, s.arr.lengths())
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Polars version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Issue description
According to the API the following should index from the first value to the end of the array, but instead raises a ComputeError exception
Reproducible example
Expected behavior
Slices to end of the array
Installed versions
The text was updated successfully, but these errors were encountered: