From fd8d741f3d55c0a5483033a33f89292af012f939 Mon Sep 17 00:00:00 2001 From: itholic Date: Wed, 2 Aug 2023 11:59:47 +0900 Subject: [PATCH] Fix behavior & test --- python/pyspark/pandas/indexes/base.py | 2 +- python/pyspark/pandas/tests/series/test_series.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/pyspark/pandas/indexes/base.py b/python/pyspark/pandas/indexes/base.py index b819d44b2312b..4c2ab13743592 100644 --- a/python/pyspark/pandas/indexes/base.py +++ b/python/pyspark/pandas/indexes/base.py @@ -2123,7 +2123,7 @@ def difference(self, other: "Index", sort: Optional[bool] = None) -> "Index": # Check if the `self` and `other` have different index types. # 1. `self` is Index, `other` is MultiIndex # 2. `self` is MultiIndex, `other` is Index - is_index_types_different = isinstance(other, Index) and not isinstance(self, type(other)) + is_index_types_different = isinstance(other, Index) and (type(self) != type(other)) if is_index_types_different: if isinstance(self, MultiIndex): # In case `self` is MultiIndex and `other` is Index, diff --git a/python/pyspark/pandas/tests/series/test_series.py b/python/pyspark/pandas/tests/series/test_series.py index 116acb2a5b2b3..38852a8f79907 100644 --- a/python/pyspark/pandas/tests/series/test_series.py +++ b/python/pyspark/pandas/tests/series/test_series.py @@ -692,7 +692,8 @@ def test_dot(self): psdf_other = ps.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, index=["x", "y", "z"]) with self.assertRaisesRegex(ValueError, "matrices are not aligned"): - psdf["b"].dot(psdf_other) + with ps.option_context("compute.ops_on_diff_frames", True): + psdf["b"].dot(psdf_other) def test_tail(self): pser = pd.Series(range(1000), name="Koalas")