ArcticDB icon indicating copy to clipboard operation
ArcticDB copied to clipboard

Index values returned by tail and row_range parameter are different than the ones returned by Pandas' tail when RangeIndex is used

Open vasil-pashov opened this issue 9 months ago • 0 comments

Describe the bug

When calling ArcticDB's tail on range indexed symbol the index always starts from 0. When calling tail on Pandas DataFrame the index values match the actual index.

Steps/Code to Reproduce

>>> import pandas
>>> pandas.DataFrame({"col": [1, 2, 3]}).tail()
>>> pandas.DataFrame({"col": [1, 2, 3]}).tail(n=1)
   col
2    3

>>> import arcticdb
>>> ac = arcticdb.Arctic("lmdb://test")
>>> lib = ac.get_library("test", create_if_missing=True)
>>> lib.write("test", pandas.DataFrame({"col": [1, 2, 3]}))
VersionedItem(symbol='test', library='test', data=n/a, version=0, metadata=None, host='LMDB(path=C:\\Users\\vasil\\Documents\\test)', timestamp=1714399391831792700)
>>> lib.tail("test", n=1).data
   col
0    3

>>> lib.write("sym", pd.DataFrame({"col": [1, 2, 3, 4, 5, 6]}))
>>> lib.read("sym", row_range=(2,5)).data
   col
0    3
1    4
2    5

Expected Results

Arctic's tail should match the result from calling Pandas' tail

OS, Python Version and ArcticDB Version

Python: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] OS: Windows-10-10.0.22631-SP0 ArcticDB: 4.4.1

Backend storage used

No response

Additional Context

No response

vasil-pashov avatar Apr 29 '24 14:04 vasil-pashov