You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/22 06:42:31 UTC
[GitHub] [spark] Yikun commented on a change in pull request #33005: [SPARK-35847][PYTHON] Manage InternalField in DataTypeOps.isnull
Yikun commented on a change in pull request #33005:
URL: https://github.com/apache/spark/pull/33005#discussion_r655920162
##########
File path: python/pyspark/pandas/tests/data_type_ops/test_num_ops.py
##########
@@ -320,29 +320,55 @@ def test_astype(self):
@unittest.skipIf(not extension_dtypes_available, "pandas extension dtypes are not available")
class IntegralExtensionOpsTest(PandasOnSparkTestCase, TestCasesUtils):
- def test_from_to_pandas(self):
- data = [1, 2, 3, None]
+ @property
+ def intergral_extension_psers(self):
dtypes = ["Int8", "Int16", "Int32", "Int64"]
- for dtype in dtypes:
- pser = pd.Series(data, dtype=dtype)
- psser = ps.Series(data, dtype=dtype)
+ return [pd.Series([1, 2, 3, None], dtype=dtype) for dtype in dtypes]
+
+ @property
+ def intergral_extension_pssers(self):
+ return [ps.from_pandas(pser) for pser in self.intergral_extension_psers]
+
+ @property
+ def intergral_extension_pser_psser_pairs(self):
+ return zip(self.intergral_extension_psers, self.intergral_extension_pssers)
+
+ def test_from_to_pandas(self):
+ for pser, psser in self.intergral_extension_pser_psser_pairs:
self.check_extension(pser, psser.to_pandas())
self.check_extension(ps.from_pandas(pser), psser)
+ def test_isnull(self):
+ for pser, psser in self.intergral_extension_pser_psser_pairs:
+ self.check_extension(pser.isnull(), psser.isnull())
Review comment:
```python
self.assert_eq(self.pser.isnull(), self.psser.isnull())
```
It should be `assert_eq`, the `psser.isnull()` return value is not ExtensionDtypes.
--
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.
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