AlenkaF commented on code in PR #37656:
URL: https://github.com/apache/arrow/pull/37656#discussion_r1322707895
##########
python/pyarrow/array.pxi:
##########
@@ -2363,6 +2363,78 @@ cdef class MapArray(ListArray):
Returns
-------
map_array : MapArray
+
+ Examples
+ --------
+ First, let's understand the structure of our dataset when viewed in a
rectangular data model.
+ The total of 5 respondents answered the question "How much did you
like the movie x?".
+ The value -1 in the integer array means that the value is missing. The
boolean array
+ represents the null bitmask corresponding to the missing values in the
integer array.
+
+ >>> movies_rectangular = np.ma.masked_array([
+ >>> [10, -1, -1],
+ >>> [8, 4, 5],
+ >>> [-1, 10, 3],
+ >>> [-1, -1, -1],
+ >>> [-1, -1, -1]
+ >>> ],
+ >>> [
+ >>> [False, True, True],
+ >>> [False, False, False],
+ >>> [True, False, False],
+ >>> [True, True, True],
+ >>> [True, True, True],
+ >>> ])
Review Comment:
```suggestion
... [10, -1, -1],
... [8, 4, 5],
... [-1, 10, 3],
... [-1, -1, -1],
... [-1, -1, -1]
... ],
... [
... [False, True, True],
... [False, False, False],
... [True, False, False],
... [True, True, True],
... [True, True, True],
... ])
```
I think this should fix the failing build due to docstest error. SImilar
should be done bellow (when the code breaks into multiple lines, `...` should
be used instead of `>>>`.
##########
python/pyarrow/array.pxi:
##########
@@ -2363,6 +2363,78 @@ cdef class MapArray(ListArray):
Returns
-------
map_array : MapArray
+
+ Examples
+ --------
+ First, let's understand the structure of our dataset when viewed in a
rectangular data model.
+ The total of 5 respondents answered the question "How much did you
like the movie x?".
+ The value -1 in the integer array means that the value is missing. The
boolean array
+ represents the null bitmask corresponding to the missing values in the
integer array.
+
+ >>> movies_rectangular = np.ma.masked_array([
+ >>> [10, -1, -1],
+ >>> [8, 4, 5],
+ >>> [-1, 10, 3],
+ >>> [-1, -1, -1],
+ >>> [-1, -1, -1]
+ >>> ],
+ >>> [
+ >>> [False, True, True],
+ >>> [False, False, False],
+ >>> [True, False, False],
+ >>> [True, True, True],
+ >>> [True, True, True],
+ >>> ])
+
+ To represent the same data with the MapArray and from_arrays, the data
is
+ formed like this:
+
+ >>> offsets = [
+ >>> 0, # -- row 1 start
+ >>> 1, # -- row 2 start
+ >>> 4, # -- row 3 start
+ >>> 6, # -- row 4 start
+ >>> 6, # -- row 5 start
+ >>> 6, # -- row 5 end
+ >>> ]
+ >>> movies = [
+ >>> "Dark Knight", # ---------------------------------- row 1
+ >>> "Dark Knight", "Meet the Parents", "Superman", # -- row 2
+ >>> "Meet the Parents", "Superman", # ----------------- row 3
Review Comment:
I totally agree it makes the example much better when using real movie
names. But on the other hand I have no experience with trademark law and if the
names shouldn't be used in an example like this? I would suspect this shouldn't
be an issue, but again, I am sure I can be surprised =)
--
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]