admin管理员组文章数量:1303428
What kind of polars expression (pl.Expr
) might be used in a filter context that will match anything including nulls?
Use case: Type hinting and helper Functions that should return an polars.Expr
.
What kind of polars expression (pl.Expr
) might be used in a filter context that will match anything including nulls?
Use case: Type hinting and helper Functions that should return an polars.Expr
.
1 Answer
Reset to default 5The expression representing the literal value True
might be used. See pl.lit
for more details.
Example.
import polars as pl
df = pl.DataFrame({
"a": [1, 2, None]
})
df.filter(pl.lit(True))
shape: (3, 1)
┌──────┐
│ a │
│ --- │
│ i64 │
╞══════╡
│ 1 │
│ 2 │
│ null │
└──────┘
Note. In general, simply True
also works, but its not an instance of pl.Expr
.
本文标签: pythonDefault filter expression to quotmatch anythingquotStack Overflow
版权声明:本文标题:python - Default filter expression to "match anything" - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741701023a2393288.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论