MCPcopy Create free account
hub / github.com/apache/arrow / get_chunks

Method get_chunks

python/pyarrow/interchange/column.py:405–426  ·  view source on GitHub ↗

Return an iterator yielding the chunks. See `DataFrame.get_chunks` for details on ``n_chunks``.

(
        self, n_chunks: Optional[int] = None
    )

Source from the content-addressed store, hash-verified

403 return 1
404
405 def get_chunks(
406 self, n_chunks: Optional[int] = None
407 ) -> Iterable[_PyArrowColumn]:
408 """
409 Return an iterator yielding the chunks.
410
411 See `DataFrame.get_chunks` for details on ``n_chunks``.
412 """
413 if n_chunks and n_chunks > 1:
414 chunk_size = self.size() // n_chunks
415 if self.size() % n_chunks != 0:
416 chunk_size += 1
417
418 array = self._col
419 i = 0
420 for start in range(0, chunk_size * n_chunks, chunk_size):
421 yield _PyArrowColumn(
422 array.slice(start, chunk_size), self._allow_copy
423 )
424 i += 1
425 else:
426 yield self
427
428 def get_buffers(self) -> ColumnBuffers:
429 """

Callers 4

test_df_get_chunksFunction · 0.45
test_column_get_chunksFunction · 0.45
_from_dataframeFunction · 0.45

Calls 3

sizeMethod · 0.95
_PyArrowColumnClass · 0.85
sliceMethod · 0.45

Tested by 3

test_df_get_chunksFunction · 0.36
test_column_get_chunksFunction · 0.36