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
It seems that Array type lacks some essential access methods like get in list namespace.
Array
get
It would also be helpful to implement a to_list method to convert an Array type to List type.
to_list
The text was updated successfully, but these errors were encountered:
There is, you can can cast.
cast
Sorry, something went wrong.
A follow up request for this is that if it is possible to implement non-strict type cast from array to list.
array
list
Currently if I cast to List without explicitly specifying the inner dtype, it will be casted to List(Null). It can be quite surprising to users.
List
List(Null)
>>> df = pl.DataFrame({"foo": [[1,2], [1,None]]}, {"foo": pl.Array(2, pl.Int32())}) >>> df shape: (2, 1) ┌───────────────┐ │ foo │ │ --- │ │ array[i32, 2] │ ╞═══════════════╡ │ [1, 2] │ │ [1, null] │ └───────────────┘ >>> df.select(pl.col.foo.cast(pl.List)) shape: (2, 1) ┌──────────────┐ │ foo │ │ --- │ │ list[null] │ ╞══════════════╡ │ [null, null] │ │ [null, null] │ └──────────────┘
Im also missing the eval function from lists, or is there a already a way to do this?
example to add 2 to every array element
>> df = pl.DataFrame({"a": pl.Series("a", [[1,2], [3,4]], dtype=pl.Array(width=2, inner=pl.Int64))}) >> df.select(pl.col("a").cast(pl.List(inner=pl.Int64)).list.eval(pl.element() + 2).cast(pl.Array(2, inner=pl.Int64))) shape: (2, 1) ┌───────────────┐ │ a │ │ --- │ │ array[i64, 2] │ ╞═══════════════╡ │ [3, 4] │ │ [5, 6] │ └───────────────┘
Successfully merging a pull request may close this issue.
Problem description
It seems that
Array
type lacks some essential access methods likeget
in list namespace.It would also be helpful to implement a
to_list
method to convert an Array type to List type.The text was updated successfully, but these errors were encountered: