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

polars operations with columns in lazyframes #12809

Closed
maxim-uvarov opened this issue May 8, 2024 · 4 comments
Closed

polars operations with columns in lazyframes #12809

maxim-uvarov opened this issue May 8, 2024 · 4 comments
Assignees
Labels
🐛 bug Something isn't working dataframe issues related to the dataframe implementation
Milestone

Comments

@maxim-uvarov
Copy link
Contributor

Describe the bug

After using polars rename error happens when trying to substract one column from another.

How to reproduce

❯ let new = ([9 8 4] | polars into-df)

> let new_2 = $new * 3 + 10 | polars rename "0" memorable

> $new_2
╭────────────────┬────────────────────────────────────────────────────╮
│ plan           │ RENAME                                             │
│                │   DF ["0"]; PROJECT */1 COLUMNS; SELECTION: "None" │
│ optimized_plan │ RENAME                                             │
│                │   DF ["0"]; PROJECT */1 COLUMNS; SELECTION: "None" │
╰────────────────┴────────────────────────────────────────────────────╯

> $new - $new_2
Error: nu::shell::cant_convert

  × Can't convert to NuDataFrame.
   ╭─[entry #18:1:8]
 1 │ $new - $new_2
   ·        ───┬──
   ·           ╰── can't convert NuLazyFrameCustomValue to NuDataFrame
   ╰──── 

Expected behavior

I expect polars to work

Screenshots

No response

Configuration

key value
version 0.93.1
major 0
minor 93
patch 1
branch main
commit_hash c54d223
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.77.2 (25ef9e3d8 2024-04-09)
rust_channel 1.77.2-aarch64-apple-darwin
cargo_version cargo 1.77.2 (e52e36006 2024-03-26)
build_time 2024-05-07 05:50:32 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, system-clipboard, trash, which
installed_plugins explore, image, inc, polars

Additional context

No response

@maxim-uvarov maxim-uvarov added the needs-triage An issue that hasn't had any proper look label May 8, 2024
@maxim-uvarov maxim-uvarov changed the title polars operations with columns in lazyframes polars math operations with columns in lazyframes May 8, 2024
@sholderbach sholderbach added 🐛 bug Something isn't working dataframe issues related to the dataframe implementation labels May 8, 2024
@ayax79
Copy link
Contributor

ayax79 commented May 9, 2024

I create a pull request for the fix: #12819

@maxim-uvarov
Copy link
Contributor Author

I checked, the example from my initial issue, and it works now. Thank you!

Though, I found a new inconsistency. I filled an issue : #12821

@sholderbach sholderbach removed the needs-triage An issue that hasn't had any proper look label May 10, 2024
@maxim-uvarov maxim-uvarov changed the title polars math operations with columns in lazyframes polars operations with columns in lazyframes May 10, 2024
@maxim-uvarov
Copy link
Contributor Author

maxim-uvarov commented May 10, 2024

I moved the content of my previous version of this comment into a separate issue: #12863

@ayax79 ayax79 self-assigned this May 10, 2024
fdncred pushed a commit that referenced this issue May 13, 2024
…terchangeably. (#12819)

Fixes Bug #12809 

The example that @maxim-uvarov posted now works as expected:

<img width="1223" alt="Screenshot 2024-05-09 at 16 21 01"
src="https://github.com/nushell/nushell/assets/56345/a4df62e3-e432-4c09-8e25-9a6c198741a3">
@maxim-uvarov
Copy link
Contributor Author

I checked the example and everything works in the latest main. Thank you @ayax79

> let new = ([9 8 4] | polars into-df)
> let new_2 = $new * 3 + 10 | polars rename "0" memorable
> $new_2
> $new - $new_2
╭─#─┬─sub_0_memorable─╮0-28 │
│ 1-26 │
│ 2-18 │
╰─#─┴─sub_0_memorable─╯

@hustcer hustcer added this to the v0.94.0 milestone May 15, 2024
FilipAndersson245 pushed a commit to FilipAndersson245/nushell that referenced this issue May 18, 2024
…terchangeably. (nushell#12819)

Fixes Bug nushell#12809 

The example that @maxim-uvarov posted now works as expected:

<img width="1223" alt="Screenshot 2024-05-09 at 16 21 01"
src="https://github.com/nushell/nushell/assets/56345/a4df62e3-e432-4c09-8e25-9a6c198741a3">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working dataframe issues related to the dataframe implementation
Projects
None yet
Development

No branches or pull requests

4 participants