MCPcopy Create free account
hub / github.com/PyTables/PyTables / iterrows

Method iterrows

tables/vlarray.py:557–590  ·  view source on GitHub ↗

Iterate over the rows of the array. This method returns an iterator yielding an object of the current flavor for each selected row in the array. If a range is not supplied, *all the rows* in the array are iterated upon. You can also use the :meth:`VLArray.__iter__`

(
        self,
        start: int | None = None,
        stop: int | None = None,
        step: int | None = None,
    )

Source from the content-addressed store, hash-verified

555 self.nrows += 1
556
557 def iterrows(
558 self,
559 start: int | None = None,
560 stop: int | None = None,
561 step: int | None = None,
562 ) -> VLArray:
563 """Iterate over the rows of the array.
564
565 This method returns an iterator yielding an object of the current
566 flavor for each selected row in the array.
567
568 If a range is not supplied, *all the rows* in the array are iterated
569 upon. You can also use the :meth:`VLArray.__iter__` special method for
570 that purpose. If you only want to iterate over a given *range of rows*
571 in the array, you may use the start, stop and step parameters.
572
573 Examples
574 --------
575 ::
576
577 for row in vlarray.iterrows(step=4):
578 print('%s[%d]--> %s' % (vlarray.name, vlarray.nrow, row))
579
580 .. versionchanged:: 3.0
581 If the *start* parameter is provided and *stop* is None then the
582 array is iterated from *start* to the last line.
583 In PyTables < 3.0 only one element was returned.
584
585 """
586 self._start, self._stop, self._step = self._process_range(
587 start, stop, step
588 )
589 self._init_loop()
590 return self
591
592 def __iter__(self) -> VLArray:
593 """Iterate over the rows of the array.

Callers

nothing calls this directly

Calls 2

_init_loopMethod · 0.95
_process_rangeMethod · 0.45

Tested by

no test coverage detected