plydata.one_table_verbs.slice_rows¶
-
class
plydata.one_table_verbs.
slice_rows
(*args, **kwargs)[source]¶ Select rows
A wrapper around
slice
to use when piping.- Parameters
Notes
If
plydata.options.modify_input_data
isTrue
,slice_rows
will not make a copy the original dataframe.Examples
>>> import pandas as pd >>> df = pd.DataFrame({'x': range(10), 'y': range(100, 110)}) >>> df >> slice_rows(5) x y 0 0 100 1 1 101 2 2 102 3 3 103 4 4 104
>>> df >> slice_rows(3, 7) x y 3 3 103 4 4 104 5 5 105 6 6 106
>>> df >> slice_rows(None, None, 3) x y 0 0 100 3 3 103 6 6 106 9 9 109
The above examples are equivalent to:
df[slice(5)] df[slice(3, 7)] df[slice(None, None, 3)]
respectively.