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

Method read_sorted

tables/table.py:1817–1849  ·  view source on GitHub ↗

Read table data following 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
        field: str | None = None,
        start: int | None = None,
        stop: int | None = None,
        step: int | None = None,
    )

Source from the content-addressed store, hash-verified

1815 return row._iter(start, stop, step, coords=index)
1816
1817 def read_sorted(
1818 self,
1819 sortby: Column | str,
1820 checkCSI: bool = False, # noqa: N803
1821 field: str | None = None,
1822 start: int | None = None,
1823 stop: int | None = None,
1824 step: int | None = None,
1825 ) -> np.ndarray:
1826 """Read table data following the order of the index of sortby column.
1827
1828 The sortby column must have associated a full index. If you want to
1829 ensure a fully sorted order, the index must be a CSI one. You may want
1830 to use the checkCSI argument in order to explicitly check for the
1831 existence of a CSI index.
1832
1833 If field is supplied only the named column will be selected. If the
1834 column is not nested, an *array* of the current flavor will be
1835 returned; if it is, a *structured array* will be used instead. If no
1836 field is specified, all the columns will be returned in a structured
1837 array of the current flavor.
1838
1839 The meaning of the start, stop and step arguments is the same as in
1840 :meth:`Table.read`.
1841
1842 .. versionchanged:: 3.0
1843 The start, stop and step parameters now behave like in slice.
1844
1845 """
1846 self._g_check_open()
1847 index = self._check_sortby_csi(sortby, checkCSI)
1848 coords = index[start:stop:step]
1849 return self.read_coordinates(coords, field)
1850
1851 def iterrows(
1852 self,

Callers 15

test01_readSorted1Method · 0.45
test01_readSorted2Method · 0.45
test01_readSorted3Method · 0.45
test05_readSorted1Method · 0.45
test05_readSorted2Method · 0.45
test05_readSorted3Method · 0.45
test05_readSorted4Method · 0.45
test05_readSorted5Method · 0.45
test05_readSorted6Method · 0.45
test05_readSorted7Method · 0.45
test05_readSorted8Method · 0.45
test05_readSorted9Method · 0.45

Calls 3

_check_sortby_csiMethod · 0.95
read_coordinatesMethod · 0.95
_g_check_openMethod · 0.80

Tested by 15

test01_readSorted1Method · 0.36
test01_readSorted2Method · 0.36
test01_readSorted3Method · 0.36
test05_readSorted1Method · 0.36
test05_readSorted2Method · 0.36
test05_readSorted3Method · 0.36
test05_readSorted4Method · 0.36
test05_readSorted5Method · 0.36
test05_readSorted6Method · 0.36
test05_readSorted7Method · 0.36
test05_readSorted8Method · 0.36
test05_readSorted9Method · 0.36