Skip to content

Commit

Permalink
Revert old test parameter order
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrumiller committed Dec 4, 2023
1 parent d8da733 commit 2e55f74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6977,7 +6977,7 @@ def pivot(
... "baz": [1, 2, 3, 4, 5, 6],
... }
... )
>>> df.pivot(index="foo", columns="bar", values="baz", aggregate_function="sum")
>>> df.pivot(values="baz", index="foo", columns="bar", aggregate_function="sum")
shape: (2, 3)
┌─────┬─────┬─────┐
│ foo ┆ y ┆ x │
Expand All @@ -6992,9 +6992,9 @@ def pivot(
>>> import polars.selectors as cs
>>> df.pivot(
... values=cs.numeric(),
... index=cs.string(),
... columns=cs.string(),
... values=cs.numeric(),
... aggregate_function="sum",
... sort_columns=True,
... ).sort(
Expand Down
8 changes: 4 additions & 4 deletions py-polars/tests/unit/operations/test_pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_pivot_categorical_index() -> None:

# test expression dispatch
result = df.pivot(
index=["A"], columns="B", values="B", aggregate_function=pl.count()
values="B", index=["A"], columns="B", aggregate_function=pl.count()
)
assert result.to_dict(as_series=False) == expected

Expand Down Expand Up @@ -305,7 +305,7 @@ def test_pivot_reinterpret_5907() -> None:
)

result = df.pivot(
values=["C"], index=["A"], columns=["B"], aggregate_function=pl.element().sum()
index=["A"], values=["C"], columns=["B"], aggregate_function=pl.element().sum()
)
expected = {"A": [3, -2], "x": [100, 50], "y": [500, -80]}
assert result.to_dict(as_series=False) == expected
Expand All @@ -331,7 +331,7 @@ def test_pivot_temporal_logical_types() -> None:
}
)
assert df.pivot(
values="value", index="idx", columns="foo", aggregate_function=None
index="idx", columns="foo", values="value", aggregate_function=None
).to_dict(as_series=False) == {
"idx": [
datetime(1977, 1, 1, 0, 0),
Expand All @@ -356,7 +356,7 @@ def test_pivot_negative_duration() -> None:
[pl.Series(name="value", values=range(len(df1) * len(df2)))]
)
assert df.pivot(
values="value", index="delta", columns="root", aggregate_function=None
index="delta", columns="root", values="value", aggregate_function=None
).to_dict(as_series=False) == {
"delta": [
timedelta(days=-2),
Expand Down

0 comments on commit 2e55f74

Please sign in to comment.