itholic commented on code in PR #41211:
URL: https://github.com/apache/spark/pull/41211#discussion_r1197458264
##########
python/pyspark/pandas/tests/test_dataframe.py:
##########
@@ -4026,10 +4030,19 @@ def test_reindex(self):
psdf.reindex(["A", "B", "C"], columns=["numbers", "2",
"3"]).sort_index(),
)
- self.assert_eq(
- pdf.reindex(["A", "B", "C"], index=["numbers", "2",
"3"]).sort_index(),
- psdf.reindex(["A", "B", "C"], index=["numbers", "2",
"3"]).sort_index(),
- )
+ # TODO(SPARK-43271): Match behavior with DataFrame.reindex with
specifying `index`.
+ if LooseVersion(pd.__version__) >= LooseVersion("2.0.0"):
+ expected_result = ps.DataFrame([1.0, 2.0, 3.0],
index=ps.Index(["A", "B", "C"]))
+ expected_result.columns = pd.Index(["numbers"], name="cols")
+ self.assert_eq(
+ psdf.reindex(["A", "B", "C"], index=["numbers", "2",
"3"]).sort_index(),
+ expected_result,
+ )
+ else:
+ self.assert_eq(
+ pdf.reindex(["A", "B", "C"], index=["numbers", "2",
"3"]).sort_index(),
+ psdf.reindex(["A", "B", "C"], index=["numbers", "2",
"3"]).sort_index(),
+ )
Review Comment:
FYI: I will address the skipped tests like this, since we can't change the
behavior for now.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]