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


##########
docs/source/python/compute.rst:
##########
@@ -292,4 +292,71 @@ The resulting dataset will be an :class:`.InMemoryDataset` 
containing the joined
    animal: [["Brittle stars",null,null]]
    n_legs: [[5,null,null]]
 
+.. _py-filter-expr:
 
+Filtering by Expressions
+========================
+
+:class:`.Table` and :class:`.Dataset` can
+both be filtered using a boolean :class:`.Expression`.
+
+The expression can be built starting from a 
+:func:`pyarrow.field`. Comparisons and transformations

Review Comment:
   That's a different field ... (maybe unfortunately, not sure if we should 
think about allowing that field object as well in the compute layer), but so 
pyarrow.field and pyarrow.compute.field are two different things
   ```suggestion
   :func:`pyarrow.compute.field`. Comparisons and transformations
   ```



##########
docs/source/python/compute.rst:
##########
@@ -292,4 +292,71 @@ The resulting dataset will be an :class:`.InMemoryDataset` 
containing the joined
    animal: [["Brittle stars",null,null]]
    n_legs: [[5,null,null]]
 
+.. _py-filter-expr:
 
+Filtering by Expressions
+========================
+
+:class:`.Table` and :class:`.Dataset` can
+both be filtered using a boolean :class:`.Expression`.
+
+The expression can be built starting from a 
+:func:`pyarrow.field`. Comparisons and transformations
+can then be applied to one or more fields to build the filter
+expression you care about.
+
+Most :ref:`compute` can be used to perform transformations
+on a ``field``.
+
+For example we could build a filter to find all rows that are even
+in column ``"nums"``
+
+.. code-block:: python
+
+   import pyarrow.compute as pc
+   even_filter = (pc.bit_wise_and(pc.field("nums"), pc.scalar(1)) == 
pc.scalar(0))

Review Comment:
   I think this is a quite advanced example, as you need to understand what 
bitwise operations do on integers (which I don't think is common knowledge 
among data analysts, I also had to look it up). But unfortunately the remainder 
is not yet available (https://issues.apache.org/jira/browse/ARROW-12755?), 
otherwise could have done the equivalent of `(arr % 2) == 0`



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