Unexpected behavior of __getitem__
of TSDataSampler: get nothing when slicing instead of indexing
#1716
Labels
bug
Something isn't working
π Bug Description
When trying to get item from TSDataSampler using
int
type index, a "speed up" feature β slicing instead of indexing will get nothing for one specific index.You would quickly notice what happened for the above code if
indices = [-1, 0, 1, 2, ...]
(because thenan_idx
is-1
), i.e., you would get nothing.To Reproduce
A piece of testing code:
Expected Behavior
Get an array with nan as the first element and some number as the second element.
Screenshot
Actual unexpected behavior:
Environment
Windows
,Linux
,MacOS
): LinuxSolution
I think it just need a simple modification of the
if
conditions, i.e.,if (np.diff(indices) == 1).all():
->if (np.diff(indices) == 1).all() and -1 not in indices:
.The text was updated successfully, but these errors were encountered: