jorisvandenbossche commented on code in PR #34184:
URL: https://github.com/apache/arrow/pull/34184#discussion_r1119737972


##########
python/pyarrow/_compute.pyx:
##########
@@ -2436,6 +2436,19 @@ cdef class Expression(_Weakrefable):
         options = NullOptions(nan_is_null=nan_is_null)
         return Expression._call("is_null", [self], options)
 
+    def is_nan(self):
+        """
+        Check whether the expression is nan.

Review Comment:
   ```suggestion
           Check whether the expression is NaN.
   ```



##########
python/pyarrow/array.pxi:
##########
@@ -1253,6 +1253,16 @@ cdef class Array(_PandasConvertible):
         options = _pc().NullOptions(nan_is_null=nan_is_null)
         return _pc().call_function('is_null', [self], options)
 
+    def is_nan(self):
+        """
+        Return BooleanArray indicating the nan values.
+
+        Returns
+        -------
+        array : boolean Array, where null values are None

Review Comment:
   What does this "where null values are None" mean exactly?



##########
python/pyarrow/array.pxi:
##########
@@ -1253,6 +1253,16 @@ cdef class Array(_PandasConvertible):
         options = _pc().NullOptions(nan_is_null=nan_is_null)
         return _pc().call_function('is_null', [self], options)
 
+    def is_nan(self):
+        """
+        Return BooleanArray indicating the nan values.

Review Comment:
   ```suggestion
           Return BooleanArray indicating the NaN values.
   ```



##########
python/pyarrow/tests/test_compute.py:
##########
@@ -1635,6 +1636,23 @@ def test_is_null():
     assert result.equals(expected)
 
 
+def test_is_nan():
+    arr = pa.array([1, 2, 3, None, np.nan])
+    result = arr.is_nan()
+    expected = pa.array([False, False, False, None, True])
+    assert result.equals(expected)
+
+    with pytest.raises(
+            ArrowNotImplementedError, match="has no kernel matching input 
types"):
+        arr = pa.array(["1", "2", None], type=pa.string())

Review Comment:
   ```suggestion
       arr = pa.array(["1", "2", None], type=pa.string())
       with pytest.raises(
               ArrowNotImplementedError, match="has no kernel matching input 
types"):
   ```
   
   And the same for the one below (although unlikely here, but that avoids that 
it might be accidentally the array creation that is erroring, instead of 
calling is_nan)



##########
python/pyarrow/table.pxi:
##########
@@ -327,6 +327,32 @@ cdef class ChunkedArray(_PandasConvertible):
         options = _pc().NullOptions(nan_is_null=nan_is_null)
         return _pc().call_function('is_null', [self], options)
 
+    def is_nan(self):
+        """
+        Return boolean array indicating the nan values.

Review Comment:
   ```suggestion
           Return boolean array indicating the NaN values.
   ```



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

Reply via email to