-
Notifications
You must be signed in to change notification settings - Fork 608
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(pivot-wider): handle the case of empty id_cols
#9912
Conversation
cc @IndexSeek |
b25bac1
to
71a3dbd
Compare
Thank you for working on this! I wanted to add a bit of context to the problem I was seeing here and to help repro/explain the desired outcome. Example datafrom ibis.interactive import *
t = ibis.memtable(dict(outcome=["yes", "no"], counted=[3, 4]))
t
┏━━━━━━━━━┳━━━━━━━━━┓
┃ outcome ┃ counted ┃
┡━━━━━━━━━╇━━━━━━━━━┩
│ string │ int64 │
├─────────┼─────────┤
│ yes │ 3 │
│ no │ 4 │
└─────────┴─────────┘ I was hoping to "transpose" this with Failed attemptt.pivot_wider(names_from="outcome", values_from="counted") Expected signature: GroupedTable(table: Relation, groupings: Annotated[tuple[Value, ...], Length(at_least=1, at_most=None)], orderings: tuple = (), havings: tuple = ()) Hacky workaround
Relatively complex workaround
|
ebad117
to
728b438
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. If you're adding none
in #9917 I guess we'll want to hold-off merging this and rebase after that one.
Yep, SGTM, I started the refactor after this PR, so I'll merge that one first and then this one. Thanks for the review(s)! |
728b438
to
89fffc0
Compare
Fixes an issue with handling simpler cases of
Table.pivot_wider
where you want to take two columns and use one as the header and one as the first and only row.