Karl Genockey

Results 271 comments of Karl Genockey

I had previously checked to see if Polars had an `enumerate()` function. (Although in this case, I guess it would be `.list.enumerate()`) ```python df.with_columns( pl.col("val").list.eval( pl.struct( index = pl.cum_count(), value...

@deanm0000 https://github.com/pola-rs/polars/issues/12222#issuecomment-1793492418 may be a better example. ```python def min_max_scaler(col.Expr)->pl.Expr: return (col - col.min()) / (col.max() - col.min()) def standard_scaler(col.Expr)->pl.Expr: return (col - col.mean()) / col.std() transformations = { 'Age':...

It sounds like something along the lines of: ```python class ExprChainImpl: def __init__(self, *exprs): self._exprs = exprs def __call__(self, *args): self._exprs = [expr(*args) for expr in self._exprs] return self def...

Yeah, those types of things all get re-written: https://github.com/pola-rs/polars/blob/24b6a54f7f56a4a30d644d90c68f2aa5802836cd/crates/polars-plan/src/logical_plan/projection.rs#L176 e.g. `pl.col('A', 'B')` gets turned into `pl.col('A'), pl.col('B')` It probably gets more complex if something was to contain expressions, not entirely...

I haven't really used the Selectors API much so it's possible I'm being silly. ```python expr + selector.as_expr() df.select((selector | selector).as_expr().sum()) ``` It seems like they are something that could...

> `pl.col('a') | pl.col('b') & pl.col.string()` would return a `Selector` @gab23r The issue is `col` already performs the operation on the values contained inside the columns. i.e. `bitwise_or(pl.col('a'), pl.col('b'))` ```python...

Yeah, I think I mentioned it at the time but may have gotten lost in translation. Essentially the equivalent of: ```python df = pl.DataFrame({ "a": [["1", "2"], ["3", "4"]], "b":...

As far as I can tell, all that is needed is to add this to `list.rs` https://github.com/pola-rs/polars/blob/2c5f4f336059a1876dda9ebad75f9f955b17ae5b/crates/polars-plan/src/dsl/function_expr/struct_.rs#L123-L134 and change `let ca = s.struct_()?; ` to `let ca = s.list()?; `...

https://github.com/pola-rs/polars/pull/12982 did implement this for `Enum` ```python df.filter(pl.col('month') >= 'Jun') # shape: (7, 2) # ┌───────┬─────┐ # │ month ┆ num │ # │ --- ┆ --- │ # │...

I think it has been mentioned a few times with regards to `.group_by` Another workaround is to `.cast(pl.List(pl.Categorical))` Not sure on the technical reasons for why it is disallowed currently.