MCPcopy Index your code
hub / github.com/PyTables/PyTables / iterrows

Method iterrows

tables/table.py:1851–1895  ·  view source on GitHub ↗

Iterate over the table using a Row instance. If a range is not supplied, *all the rows* in the table are iterated upon - you can also use the :meth:`Table.__iter__` special method for that purpose. If you want to iterate over a given *range of rows* in the table, you

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

Source from the content-addressed store, hash-verified

1849 return self.read_coordinates(coords, field)
1850
1851 def iterrows(
1852 self,
1853 start: int | None = None,
1854 stop: int | None = None,
1855 step: int | None = None,
1856 ) -> Iterator[tableextension.Row]:
1857 """Iterate over the table using a Row instance.
1858
1859 If a range is not supplied, *all the rows* in the table are iterated
1860 upon - you can also use the :meth:`Table.__iter__` special method for
1861 that purpose. If you want to iterate over a given *range of rows* in
1862 the table, you may use the start, stop and step parameters.
1863
1864 .. warning::
1865
1866 When in the middle of a table row iterator, you should not
1867 use methods that can change the number of rows in the table
1868 (like :meth:`Table.append` or :meth:`Table.remove_rows`) or
1869 unexpected errors will happen.
1870
1871 See Also
1872 --------
1873 tableextension.Row : the table row iterator and field accessor
1874
1875 Examples
1876 --------
1877 ::
1878
1879 result = [ row['var2'] for row in table.iterrows(step=5)
1880 if row['var1'] <= 20 ]
1881
1882 .. versionchanged:: 3.0
1883 If the *start* parameter is provided and *stop* is None then the
1884 table is iterated from *start* to the last line.
1885 In PyTables < 3.0 only one element was returned.
1886
1887 """
1888 start, stop, step = self._process_range(
1889 start, stop, step, warn_negstep=False
1890 )
1891 if (start > stop and 0 < step) or (start < stop and 0 > step):
1892 # Fall-back action is to return an empty iterator
1893 return iter([])
1894 row = tableextension.Row(self)
1895 return row._iter(start, stop, step)
1896
1897 def __iter__(self) -> Iterator[tableextension.Row]:
1898 """Iterate over the table using a Row instance.

Callers 15

append_whereMethod · 0.95
__iter__Method · 0.95
get_cacheMethod · 0.45
test_methodFunction · 0.45
test02_sssEArrayMethod · 0.45
test01_readTableMethod · 0.45
test01a_integerMethod · 0.45
test01a_extsliceMethod · 0.45
test01b_readTableMethod · 0.45
test01c_readTableMethod · 0.45
test01d_readTableMethod · 0.45

Calls 1

_process_rangeMethod · 0.45

Tested by 15

test_methodFunction · 0.36
test02_sssEArrayMethod · 0.36
test01_readTableMethod · 0.36
test01a_integerMethod · 0.36
test01a_extsliceMethod · 0.36
test01b_readTableMethod · 0.36
test01c_readTableMethod · 0.36
test01d_readTableMethod · 0.36
test02_AppendRowsMethod · 0.36
_test02a_AppendRowsMethod · 0.36
test02b_AppendRowsMethod · 0.36