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

Method itersorted

tables/table.py:1782–1815  ·  view source on GitHub ↗

Iterate table data in the order of the index of sortby column. The sortby column must have associated a full index. If you want to ensure a fully sorted order, the index must be a CSI one. You may want to use the checkCSI argument in order to explicitly check for the

(
        self,
        sortby: Column | str,
        checkCSI: bool = False,  # noqa: N803
        start: int | None = None,
        stop: int | None = None,
        step: int | None = None,
    )

Source from the content-addressed store, hash-verified

1780 )
1781
1782 def itersorted(
1783 self,
1784 sortby: Column | str,
1785 checkCSI: bool = False, # noqa: N803
1786 start: int | None = None,
1787 stop: int | None = None,
1788 step: int | None = None,
1789 ) -> Iterator[tableextension.Row]:
1790 """Iterate table data in the order of the index of sortby column.
1791
1792 The sortby column must have associated a full index. If you want to
1793 ensure a fully sorted order, the index must be a CSI one. You may want
1794 to use the checkCSI argument in order to explicitly check for the
1795 existence of a CSI index.
1796
1797 The meaning of the start, stop and step arguments is the same as in
1798 :meth:`Table.read`.
1799
1800 .. versionchanged:: 3.0
1801 If the *start* parameter is provided and *stop* is None then the
1802 table is iterated from *start* to the last line.
1803 In PyTables < 3.0 only one element was returned.
1804
1805 """
1806 index = self._check_sortby_csi(sortby, checkCSI)
1807 # Adjust the slice to be used.
1808 start, stop, step = self._process_range(
1809 start, stop, step, warn_negstep=False
1810 )
1811 if (start > stop and 0 < step) or (start < stop and 0 > step):
1812 # Fall-back action is to return an empty iterator
1813 return iter([])
1814 row = tableextension.Row(self)
1815 return row._iter(start, stop, step, coords=index)
1816
1817 def read_sorted(
1818 self,

Callers 10

test04_itersorted1Method · 0.80
test04_itersorted2Method · 0.80
test04_itersorted3Method · 0.80
test04_itersorted4Method · 0.80
test04_itersorted5Method · 0.80
test04_itersorted6Method · 0.80
test04_itersorted7Method · 0.80
test04_itersorted8Method · 0.80
test04_itersorted9Method · 0.80
test04_itersorted10Method · 0.80

Calls 2

_check_sortby_csiMethod · 0.95
_process_rangeMethod · 0.45

Tested by 10

test04_itersorted1Method · 0.64
test04_itersorted2Method · 0.64
test04_itersorted3Method · 0.64
test04_itersorted4Method · 0.64
test04_itersorted5Method · 0.64
test04_itersorted6Method · 0.64
test04_itersorted7Method · 0.64
test04_itersorted8Method · 0.64
test04_itersorted9Method · 0.64
test04_itersorted10Method · 0.64