ArcticDB icon indicating copy to clipboard operation
ArcticDB copied to clipboard

Make `row_range` take `None` to indicate to the start/end of the symbol

Open DrNickClarke opened this issue 5 months ago • 0 comments

In Pandas you can use

df.iloc[slice(5, None)] or df.iloc[5:]

to slice from row 5 to the end of the dataframe.

It would be useful if the row_range could take None to give a similar behaviour.

So

lib.read(sym, row_range=(None, 10)

would give the first 10 rows of the data.

lib.read(sym, row_range=(10, None))

would give the rows starting at row 10 and running to the end of the data.

Note the the first example is the same as row_range=(0, 10) or lib.head(sym, 10).

The second example is the same as lib.tail(-10) but cannot be done with row_range unless you already know how many rows are in the data (eg. using get_description()).

row_range can be used with read_batch() so offers a little more flexibility than head or tail.

DrNickClarke avatar Sep 24 '24 09:09 DrNickClarke