NikolayKosarevO9 commented on issue #40576:
URL: https://github.com/apache/arrow/issues/40576#issuecomment-2012379092

   Here's how I do it:
   
   ```
   import pyarrow.dataset as ds
   
   def yield_batches(dir_path: str, cols: list[str], batch_size: int = 
50_000_000) -> Generator[pd.DataFrame, None, None]:
       dataset = ds.dataset(dir_path, format="parquet")
       for b in dataset.to_batches(columns=cols, batch_size=batch_size):
                   yield b.to_pandas()
   ```
   
   Experimenting with different batch sizes, you can see that the maximum 
attainable value is 1048576, even if a larger number is specified.


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