Skip to content

Commit

Permalink
test: Add pivot test #17081
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Jun 20, 2024
1 parent ce0ce02 commit f235f2b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions py-polars/tests/unit/operations/test_pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,21 @@ def test_list_pivot() -> None:
"x": [1, 2, None],
"y": [4, None, 3],
}


def test_pivot_string_17081() -> None:
df = pl.DataFrame(
{
"a": ["1", "2", "3"],
"b": ["4", "5", "6"],
"c": ["7", "8", "9"],
}
)
assert df.pivot(
index="a", columns="b", values="c", aggregate_function="min"
).to_dict(as_series=False) == {
"a": ["1", "2", "3"],
"4": ["7", None, None],
"5": [None, "8", None],
"6": [None, None, "9"],
}

0 comments on commit f235f2b

Please sign in to comment.