Comments (3)
Can also reproduce on 1.0.0-rc2
df = pl.DataFrame({'material': [['PB', 'PVC', 'CI'], ['CI'], ['CI']]})
df.with_columns(
result = pl.when(pl.col.material.list.len() == 1).then('material').list.get(0)
)
# shape: (3, 2)
# ┌─────────────────────┬────────┐
# │ material ┆ result │
# │ --- ┆ --- │
# │ list[str] ┆ str │
# ╞═════════════════════╪════════╡
# │ ["PB", "PVC", "CI"] ┆ null │
# │ ["CI"] ┆ PB │ # <- value from row 0 ???
# │ ["CI"] ┆ PVC │ # <- value from row 0 ???
# └─────────────────────┴────────┘
slice/head do not appear to be affected.
df.with_columns(
result = pl.when(pl.col.material.list.len() == 1).then('material').list.slice(0, 1)
)
# shape: (3, 2)
# ┌─────────────────────┬───────────┐
# │ material ┆ result │
# │ --- ┆ --- │
# │ list[str] ┆ list[str] │
# ╞═════════════════════╪═══════════╡
# │ ["PB", "PVC", "CI"] ┆ null │
# │ ["CI"] ┆ ["CI"] │
# │ ["CI"] ┆ ["CI"] │
# └─────────────────────┴───────────┘
from polars.
thanks for the report @lscheilling and @cmdlineluser for the smaller reproducer
not sure if it counts as 'critical' or 'high' prio
from polars.
from git bisect, this is due to #15516
going to ping @reswqa and @ritchie46 then (no blame at all of course 🤗 )
from polars.
Related Issues (20)
- Add DRY equivalent for Series HOT 8
- Unexpected results occur when using the head(1) expression in the select method.
- Add cumulative n_unique HOT 1
- Series constructor with NumPy datetime64 scalar returns incorrect results
- Request for new method argmax_horizontal HOT 2
- `pl.struct` inside `list.eval` produces different dtype if fields are named
- Add `Expr.scatter` HOT 3
- Example code for `group_by` iteration is wrong HOT 1
- `unpivot()` on an empty DataFrame creates two empty `variable` columns
- SQL expression panics on invalid query HOT 1
- Make series raw display output to not use single quotes to be consistent with the DataFrame raw display outputs. HOT 9
- ParquetWriter<CloudWriter> hangs when uploading to S3
- When using `.implode().list` in `GroupBy.agg`, the return type is list, not the original type of the value. HOT 2
- `Series.search_sorted` gives wrong answer when using expression arguments HOT 4
- Panic occurring when using streaming and limit with Parquet
- `Expr.replace` and `Expr.replace_strict` set "NO_DEFAULT" as a value HOT 1
- Raises ComputeError when reading parquet from presigned S3 URL HOT 2
- Wrong result when filtering categorical using `.is_in` in `scan_parquet` HOT 2
- `.over()` fails with `.get`. HOT 2
- Don't disable coalesce when joining on expressions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polars.