Skip to content

Commit 7769644

Browse files
ueshinHyukjinKwon
authored andcommitted
[SPARK-35981][PYTHON][TEST] Use check_exact=False to loosen the check precision
### What changes were proposed in this pull request? We should use `check_exact=False` because the value check in `StatsTest.test_cov_corr_meta` is too strict. ### Why are the changes needed? In some environment, the precision could be different in pandas' `DataFrame.corr` function and the test `StatsTest.test_cov_corr_meta` fails. ``` AssertionError: DataFrame.iloc[:, 0] (column name="a") are different DataFrame.iloc[:, 0] (column name="a") values are different (14.28571 %) [index]: [a, b, c, d, e, f, g] [left]: [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0] [right]: [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 4.807406715958909e-17] ``` ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Modified tests should still pass. Closes #33179 from ueshin/issuse/SPARK-35981/corr. Authored-by: Takuya UESHIN <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
1 parent 0c9c8ff commit 7769644

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/pyspark/pandas/tests/test_stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def test_cov_corr_meta(self):
283283
index=pd.Index([1, 2, 3], name="myindex"),
284284
)
285285
psdf = ps.from_pandas(pdf)
286-
self.assert_eq(psdf.corr(), pdf.corr())
286+
self.assert_eq(psdf.corr(), pdf.corr(), check_exact=False)
287287

288288
def test_stats_on_boolean_dataframe(self):
289289
pdf = pd.DataFrame({"A": [True, False, True], "B": [False, False, True]})

0 commit comments

Comments
 (0)