Read table data fulfilling the given *condition*. This method is similar to :meth:`Table.read`, having their common arguments and return values the same meanings. However, only the rows fulfilling the *condition* are included in the result. The meaning of the other
(
self,
condition: str,
condvars: dict[str, Column | np.ndarray] | None = None,
field=None,
start: str | None = None,
stop: str | None = None,
step: str | None = None,
)
| 1621 | return row._iter(start, stop, step, chunkmap=chunkmap) |
| 1622 | |
| 1623 | def read_where( |
| 1624 | self, |
| 1625 | condition: str, |
| 1626 | condvars: dict[str, Column | np.ndarray] | None = None, |
| 1627 | field=None, |
| 1628 | start: str | None = None, |
| 1629 | stop: str | None = None, |
| 1630 | step: str | None = None, |
| 1631 | ) -> np.ndarray: |
| 1632 | """Read table data fulfilling the given *condition*. |
| 1633 | |
| 1634 | This method is similar to :meth:`Table.read`, having their common |
| 1635 | arguments and return values the same meanings. However, only the rows |
| 1636 | fulfilling the *condition* are included in the result. |
| 1637 | |
| 1638 | The meaning of the other arguments is the same as in the |
| 1639 | :meth:`Table.where` method. |
| 1640 | |
| 1641 | """ |
| 1642 | self._g_check_open() |
| 1643 | coords = [ |
| 1644 | p.nrow for p in self._where(condition, condvars, start, stop, step) |
| 1645 | ] |
| 1646 | self._where_condition = None # reset the conditions |
| 1647 | if len(coords) > 1: |
| 1648 | cstart, cstop = coords[0], coords[-1] + 1 |
| 1649 | if cstop - cstart == len(coords): |
| 1650 | # Chances for monotonically increasing row values. Refine. |
| 1651 | inc_seq = np.all(np.arange(cstart, cstop) == np.array(coords)) |
| 1652 | if inc_seq: |
| 1653 | return self.read(cstart, cstop, field=field) |
| 1654 | return self.read_coordinates(coords, field) |
| 1655 | |
| 1656 | def append_where( |
| 1657 | self, |