You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "AlenkaF (via GitHub)" <gi...@apache.org> on 2023/06/01 09:47:58 UTC

[GitHub] [arrow] AlenkaF commented on pull request #35865: GH-35740: Add documentation for list arrays' values property

AlenkaF commented on PR #35865:
URL: https://github.com/apache/arrow/pull/35865#issuecomment-1571716355

   Thank you for the contribution @spenczar !
   
   I think the main difference between `values` and `flatten` is when the array is a slice into another array (see description in https://arrow.apache.org/docs/dev/cpp/api/array.html#_CPPv4N5arrow18FixedSizeListArrayE). You could play around with looking at the code for `array = pa.array([[1, 2], None, [3, None]],type=pa.large_list(pa.int32()))`and `array.slice(0, 1)`.
   
   You are correct in the understanding that the behaviour of `FixedSizeListArray.values` is a bit different. I am now aware of the reason for this, but the difference can be seen in the link to the docs from before (https://arrow.apache.org/docs/dev/cpp/api/array.html#_CPPv4N5arrow9ListArrayE).
   
   Some nit for finish: there are doctest errors that need to be fixed with adding `...`:
   ```
   =================================== FAILURES ===================================
   ___________ [doctest] pyarrow.lib.FixedSizeListArray.values.__get__ ____________
   2378         values : Array
   2379 
   2380         Examples
   2381         --------
   2382         >>> import pyarrow as pa
   2383         >>> array = pa.array(
   2384         ...     [[1, 2], None, [3, None]],
   2385         ...     type=pa.list_(pa.int32(), 2)
   2386         ... )
   2387         >>> array.values
   Differences (unified diff with -expected +actual):
       @@ -1,3 +1,3 @@
       -<pyarrow.lib.Int32Array object at 0x12d1743a0>
       +<pyarrow.lib.Int32Array object at 0x7f3828fa5440>
        [
          1,
   
   /opt/conda/envs/arrow/lib/python3.9/site-packages/pyarrow/lib.cpython-39-x86_64-linux-gnu.so:2387: DocTestFailure
   _____________ [doctest] pyarrow.lib.LargeListArray.values.__get__ ______________
   2189         values : Array
   2190 
   2191         Examples
   2192         --------
   2193         >>> import pyarrow as pa
   2194         >>> array = pa.array(
   2195         ...     [[1, 2], None, [3, 4, None, 6]],
   2196         ...     type=pa.large_list(pa.int32()),
   2197         ... )
   2198         >>> array.values
   Differences (unified diff with -expected +actual):
       @@ -1,3 +1,3 @@
       -<pyarrow.lib.Int32Array object at 0x12d174100>
       +<pyarrow.lib.Int32Array object at 0x7f3828faeb40>
        [
          1,
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org