Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError in labeler.py #395

Open
PierrickPochelu opened this issue Jul 29, 2022 · 0 comments
Open

KeyError in labeler.py #395

PierrickPochelu opened this issue Jul 29, 2022 · 0 comments

Comments

@PierrickPochelu
Copy link

PierrickPochelu commented Jul 29, 2022

https://github.com/numenta/NAB/blob/master/nab/labeler.py line 424

The following code:

         front = max(a - windowLength/2, 0)
        back = min(a + windowLength/2, length-1)

        windowLimit = [strf(data["timestamp"][front]),
                       strf(data["timestamp"][back])]

Produces:
KeyError due to the fact front may be a decimal value

Should be:

        front = int(round(max(a - windowLength/2, 0)))
        back = int(round(min(a + windowLength/2, length-1)))

        windowLimit = [strf(data["timestamp"][front]),
                       strf(data["timestamp"][back])]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant