pitrou commented on code in PR #41904:
URL: https://github.com/apache/arrow/pull/41904#discussion_r1708879828


##########
python/pyarrow/tests/test_csv.py:
##########
@@ -54,18 +53,32 @@ def generate_col_names():
             yield first + second
 
 
+def split_rows(arr, num_cols, num_rows):
+    # Split a num_cols x num_rows array into rows
+    for i in range(0, num_rows*num_cols, num_cols):
+        yield list(itertools.islice(arr, i, i + num_cols))

Review Comment:
   I've just noticed that you're going through `itertools.islice` just to 
accumulate the results into a list, so you can probably slice the input 
directly, which is going to be much more efficient:
   ```suggestion
       for i in range(0, num_rows * num_cols, num_cols):
           yield arr[i:i + num_cols]
   ```
   ```



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