Skip to content

InvalidLabelCountError(bracket_count, label_count) Source

Bases: NumdaplotError

Raised when the labels of Brackets are not exactly one per bracket.

There is one bracket between two limits, plus one for each open end.

Added in version 0.1.0

Parameters:

  • bracket_count (int)

    The number of brackets.

  • label_count (int)

    The number of labels given.

Attributes:

  • bracket_count

    The number of brackets.

  • label_count

    The number of labels given.

Examples:

import numdaplot as ndp

try:
    ndp.Brackets(limits=[0, 18, 65], labels=["child", "adult", "senior"])
except ndp.InvalidLabelCountError as error:
    print(error)
# Expected 2 labels, one per bracket, got 3.