You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/06 08:47:14 UTC

[GitHub] [arrow] amol- commented on a diff in pull request #12754: ARROW-15429: [Python] Address docstrings for ChunkedArray class, methods, attributes and constructor

amol- commented on code in PR #12754:
URL: https://github.com/apache/arrow/pull/12754#discussion_r843675028


##########
python/pyarrow/table.pxi:
##########
@@ -357,6 +509,29 @@ cdef class ChunkedArray(_PandasConvertible):
         Returns
         -------
         cast : Array or ChunkedArray
+
+        Examples
+        --------
+        >>> import pyarrow as pa
+        >>> n_legs = pa.chunked_array([[2, 2, 4], [4, 5, 100]])
+        >>> n_legs.type
+        DataType(int64)
+        >>> n_legs.cast(pa.duration('s')).type
+        DurationType(duration[s])
+        >>> n_legs.cast(pa.duration('s'))
+        <pyarrow.lib.ChunkedArray object at ...>
+        [
+          [
+            2,
+            2,
+            4
+          ],
+          [
+            4,
+            5,
+            100
+          ]
+        ]

Review Comment:
   This is a bit unclear.
   I think it might improve if we assign the output of `cast` to some variable and show that the type of the variable changed. Like
   ```
   >>> n_legs_seconds = n_lefts.cast(pa.duration("s"))
   >>> n_legs_seconds.type
   DurationType(duration[s])
   ```



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