Skip to content

KeyError in labeler.py #395

Description

@PierrickPochelu

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])]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions