xinrong-databricks commented on code in PR #36981:
URL: https://github.com/apache/spark/pull/36981#discussion_r906847702


##########
python/pyspark/pandas/tests/test_dataframe.py:
##########
@@ -96,6 +96,13 @@ def test_dataframe(self):
         index_cols = pdf.columns[column_mask]
         self.assert_eq(psdf[index_cols], pdf[index_cols])
 
+    def test_creation_index(self):
+        with self.assertRaisesRegex(
+            TypeError,
+            "The given index cannot be a pandas-on-Spark index. Try 
pandas.Index or array-like.",
+        ):
+            ps.DataFrame([1, 2], index=ps.Index([1, 2]))

Review Comment:
   Thanks!



##########
python/pyspark/pandas/tests/test_series.py:
##########
@@ -54,6 +54,13 @@ def pser(self):
     def psser(self):
         return ps.from_pandas(self.pser)
 
+    def test_creation_index(self):
+        with self.assertRaisesRegex(
+            TypeError,
+            "The given index cannot be a pandas-on-Spark index. Try 
pandas.Index or array-like.",
+        ):
+            ps.Series([1, 2], index=ps.Index([1, 2]))

Review Comment:
   Makes sense! Added tests.



-- 
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]

Reply via email to