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

Method remove_rows

tables/table.py:2769–2826  ·  view source on GitHub ↗

Remove a range of rows in the table. If only start is supplied, that row and all following will be deleted. If a range is supplied, i.e. both the start and stop parameters are passed, all the rows in the range are removed. .. versionchanged:: 3.0 The star

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

Source from the content-addressed store, hash-verified

2767 return indexedrows
2768
2769 def remove_rows(
2770 self,
2771 start: int | None = None,
2772 stop: int | None = None,
2773 step: int | None = None,
2774 ) -> int:
2775 """Remove a range of rows in the table.
2776
2777 If only start is supplied, that row and all following will be deleted.
2778 If a range is supplied, i.e. both the start and stop parameters are
2779 passed, all the rows in the range are removed.
2780
2781 .. versionchanged:: 3.0
2782 The start, stop and step parameters now behave like in slice.
2783
2784 .. seealso:: remove_row()
2785
2786 Parameters
2787 ----------
2788 start : int
2789 Sets the starting row to be removed. It accepts negative values
2790 meaning that the count starts from the end. A value of 0 means the
2791 first row.
2792 stop : int
2793 Sets the last row to be removed to stop-1, i.e. the end point is
2794 omitted (in the Python range() tradition). Negative values are also
2795 accepted. If None all rows after start will be removed.
2796 step : int
2797 The step size between rows to remove.
2798
2799 .. versionadded:: 3.0
2800
2801 Examples
2802 --------
2803 Removing rows from 5 to 10 (excluded)::
2804
2805 t.remove_rows(5, 10)
2806
2807 Removing all rows starting from the 10th::
2808
2809 t.remove_rows(10)
2810
2811 Removing the 6th row::
2812
2813 t.remove_rows(6, 7)
2814
2815 .. note::
2816
2817 removing a single row can be done using the specific
2818 :meth:`remove_row` method.
2819
2820 """
2821 start, stop, step = self._process_range(start, stop, step)
2822 nrows = self._remove_rows(start, stop, step)
2823 # remove_rows is an invalidating index operation
2824 self._reindex(self.colpathnames)
2825
2826 return SizeType(nrows)

Callers 13

remove_rowMethod · 0.95
_logMethod · 0.80
test04_deleteMethod · 0.80
test04b_deleteMethod · 0.80
test04c_deleteMethod · 0.80
test04d_deleteMethod · 0.80
test04e_deleteMethod · 0.80
test04f_deleteMethod · 0.80
test04g_deleteMethod · 0.80
test05_icountersMethod · 0.80
test06_dirtyMethod · 0.80
tutorial1-2.pyFile · 0.80

Calls 2

_reindexMethod · 0.95
_process_rangeMethod · 0.45

Tested by 9

test04_deleteMethod · 0.64
test04b_deleteMethod · 0.64
test04c_deleteMethod · 0.64
test04d_deleteMethod · 0.64
test04e_deleteMethod · 0.64
test04f_deleteMethod · 0.64
test04g_deleteMethod · 0.64
test05_icountersMethod · 0.64
test06_dirtyMethod · 0.64