You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "asl3 (via GitHub)" <gi...@apache.org> on 2023/08/04 02:05:50 UTC
[GitHub] [spark] asl3 commented on a diff in pull request #42332: [SPARK-44665] Add support for pandas DataFrame assertDataFrameEqual
asl3 commented on code in PR #42332:
URL: https://github.com/apache/spark/pull/42332#discussion_r1283898250
##########
python/pyspark/sql/tests/test_utils.py:
##########
@@ -746,28 +748,123 @@ def test_assert_unequal_null_expected(self):
)
def test_assert_equal_exact_pandas_df(self):
+ df1 = pd.DataFrame(
+ data=np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)]), columns=["a", "b", "c"]
+ )
+ df2 = pd.DataFrame(
+ data=np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)]), columns=["a", "b", "c"]
+ )
+
+ assertDataFrameEqual(df1, df2, checkRowOrder=False)
Review Comment:
@zhengruifeng Yes, since `assertDataFrameEqual` asserts approximate equality by default for float-like values, it will call the [pandasutils.py](https://github.com/apache/spark/blob/4ed59d932631ba819d6b6071ee91408622a312db/python/pyspark/testing/pandasutils.py#L4) `_assert_pandas_almost_equal` util to assert approximate equality for float-like vals (instead of the pandasutils.py `_assert_pandas_equal`, which has the same behavior as pandas assert_frame_equal).
The `assertPandasOnSparkEqual` from pandasutils.py calls `_assert_pandas_equal` or `_assert_pandas_almost_equal` depending on user config
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org