Skip to content

Commit

Permalink
fix(pivot-wider): handle empty id columns
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 25, 2024
1 parent 6f48f0e commit ebad117
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ibis/expr/types/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4432,7 +4432,13 @@ def pivot_wider(
key = names_sep.join(filter(None, key_components))
aggs[key] = arg if values_fill is None else arg.coalesce(values_fill)

return self.group_by(id_cols).aggregate(**aggs)
id_cols = id_cols.expand(self)

# no id columns, so do an ungrouped aggregation
if not id_cols:
return self.aggregate(**aggs)

return self.group_by(*id_cols).aggregate(**aggs)

def relocate(
self,
Expand Down

0 comments on commit ebad117

Please sign in to comment.