-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
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
Add pl.lit(list) #6608
Comments
The problem is that there aren't literal lists in dataframes For instance, taking your example |
@deanm0000 that makes sense, but since a |
touche. So it seems what you're after is being able to do
but without the, seemingly, superfluous |
I'd have thought In [1]: df = pl.DataFrame({
...: 'a': [
...: [1, 1],
...: [2, 2]
...: ]
...: })
...: df.filter(pl.col('a') == pl.concat_list([1, 1]))
Out[1]:
shape: (2, 1)
┌───────────┐
│ a │
│ --- │
│ list[i64] │
╞═══════════╡
│ [1, 1] │
│ [2, 2] │
└───────────┘
In [2]: df = pl.DataFrame({
...: 'a': [
...: [1, 1],
...: [2, 2]
...: ]
...: })
...: df.filter(pl.col('a') == pl.concat_list([1, 9]))
Out[2]:
shape: (0, 1)
┌───────────┐
│ a │
│ --- │
│ list[i64] │
╞═══════════╡
└───────────┘ |
Problem description
Stems from #6596. Literal lists would be very useful for series with dtype
pl.List
. Example:In a more useful context, it would be inferred, e.g:
The text was updated successfully, but these errors were encountered: