rustyconover commented on issue #44961:
URL: https://github.com/apache/arrow/issues/44961#issuecomment-2541581760

   Is there a scalar length function for arrays like there is for strings?
   
   Rusty
   
   On Fri, Dec 13, 2024 at 01:21 Joris Van den Bossche <
   ***@***.***> wrote:
   
   > To my previous comment, I think you might misinterpret what count is
   > exactly doing, as it is not a scalar function, i.e. it is not counting the
   > values per element in the list array (so you can't use it to filter empty
   > *rows*).
   >
   > If you call the function on the actual data (so it executes eagerly and
   > not through an expression);
   >
   > In [28]: data = [["peanuts", "shellfish", "gluten"], ["dust", "pollen"], 
["cats", "dogs", "feathers"], []]
   >     ...:
   >     ...: # Create a PyArrow array
   >     ...: allergies_array = pa.array(data, type=pa.list_(pa.string()))
   >
   > In [29]: pc.count(allergies_array, mode="all")
   > Out[29]: <pyarrow.Int64Scalar: 4>
   >
   > It counts that the full array has 4 elements (so kind of the length of the
   > array, except that by default it only counts the non-null values)
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/arrow/issues/44961#issuecomment-2540848821>,
   > or unsubscribe
   > 
<https://github.com/notifications/unsubscribe-auth/AAFSWJJINR7HSHVS2WAIYGD2FKKIRAVCNFSM6AAAAABTF5VRXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBQHA2DQOBSGE>
   > .
   > You are receiving this because you were mentioned.Message ID:
   > ***@***.***>
   >
   


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