Skip to content

Commit

Permalink
Stop passing ddof to pl.corr in Python unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
flowlight0 committed Dec 6, 2024
1 parent b880194 commit f066519
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions py-polars/tests/unit/lazyframe/test_lazyframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ def test_spearman_corr_ties() -> None:
df = pl.DataFrame({"a": [1, 1, 1, 2, 3, 7, 4], "b": [4, 3, 2, 2, 4, 3, 1]})

result = df.select(
pl.corr("a", "b", method="spearman", ddof=0).alias("a1"),
pl.corr("a", "b", method="spearman").alias("a1"),
pl.corr(pl.col("a").rank("min"), pl.col("b").rank("min")).alias("a2"),
pl.corr(pl.col("a").rank(), pl.col("b").rank()).alias("a3"),
)
Expand All @@ -972,7 +972,9 @@ def test_pearson_corr() -> None:
out = (
ldf.group_by("era", maintain_order=True).agg(
pl.corr(
pl.col("prediction"), pl.col("target"), method="pearson", ddof=0
pl.col("prediction"),
pl.col("target"),
method="pearson",
).alias("c"),
)
).collect()["c"]
Expand All @@ -981,7 +983,7 @@ def test_pearson_corr() -> None:
# we can also pass in column names directly
out = (
ldf.group_by("era", maintain_order=True).agg(
pl.corr("prediction", "target", method="pearson", ddof=0).alias("c"),
pl.corr("prediction", "target", method="pearson").alias("c"),
)
).collect()["c"]
assert out.to_list() == pytest.approx([0.6546536707079772, -5.477514993831792e-1])
Expand Down

0 comments on commit f066519

Please sign in to comment.