Skip to content
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

fix: Allow .struct.with_fields inside list.eval #19617

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

cmdlineluser
Copy link
Contributor

@cmdlineluser cmdlineluser commented Nov 3, 2024

Closes #17356

df = pl.DataFrame({
    "x": [[{"a": 1, "b": 2}], [{"a": 3, "b": 4}]]
})

df.with_columns(
    pl.col.x.list.eval(pl.element().struct.with_fields(c = pl.field("a") + 10))
)    

# shape: (2, 1)
# ┌─────────────────┐
# │ x               │
# │ ---             │
# │ list[struct[3]] │
# ╞═════════════════╡
# │ [{1,2,11}]      │
# │ [{3,4,13}]      │
# └─────────────────┘

All tests still pass - but I'm not sure if there may be a reason why the flag is currently disabled.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Nov 3, 2024
Copy link

codecov bot commented Nov 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.96%. Comparing base (0b0a914) to head (70eb548).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19617      +/-   ##
==========================================
- Coverage   79.96%   79.96%   -0.01%     
==========================================
  Files        1536     1536              
  Lines      211374   211374              
  Branches     2445     2445              
==========================================
- Hits       169034   169033       -1     
- Misses      41785    41786       +1     
  Partials      555      555              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46
Copy link
Member

All tests still pass - but I'm not sure if there may be a reason why the flag is currently disabled.

I think this was overly conservative. Thanks for the fix.

@ritchie46 ritchie46 merged commit 7be7f06 into pola-rs:main Nov 4, 2024
26 of 27 checks passed
tylerriccio33 pushed a commit to tylerriccio33/polars that referenced this pull request Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ComputeError: this expression cannot run in the group_by context
2 participants