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

Method __iter__

tables/table.py:3704–3717  ·  view source on GitHub ↗

Iterate through all items in the column.

(self)

Source from the content-addressed store, hash-verified

3702 raise TypeError("'%s' key type is not valid in this context" % key)
3703
3704 def __iter__(self) -> Generator[np.ndarray]:
3705 """Iterate through all items in the column."""
3706 table = self.table
3707 itemsize = self.dtype.itemsize
3708 nrowsinbuf = table._v_file.params["IO_BUFFER_SIZE"] // itemsize
3709 buf = np.empty((nrowsinbuf,), self._itemtype)
3710 max_row = len(self)
3711 for start_row in range(0, len(self), nrowsinbuf):
3712 end_row = min(start_row + nrowsinbuf, max_row)
3713 buf_slice = buf[0 : end_row - start_row]
3714 table.read(
3715 start_row, end_row, 1, field=self.pathname, out=buf_slice
3716 )
3717 yield from buf_slice
3718
3719 def __setitem__(self, key: int | slice, value: Any) -> int:
3720 """Set a row or a range of rows in a column.

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected