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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]