Skip to content

Commit

Permalink
Check if length of index in pivot operation is non-zero. Fixes: #3343. (
Browse files Browse the repository at this point in the history
  • Loading branch information
ghuls committed May 10, 2022
1 parent 4c3644a commit e37620d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions polars/polars-core/src/frame/groupby/pivot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ impl DataFrame {
sort_columns: bool,
stable: bool,
) -> Result<DataFrame> {
if index.is_empty() {
return Err(PolarsError::ComputeError(
"index cannot be zero length".into(),
));
}

let mut final_cols = vec![];

let mut count = 0;
Expand Down

0 comments on commit e37620d

Please sign in to comment.