trendlist.trendlist.Trend

class trendlist.trendlist.Trend(mean: Optional[Union[float, int]] = None, length: int = 1)

Bases: object

Represent a single trend.

Attributes:

mean: The trend’s arithmetic mean length: The trend’s length. (default: 1)

Raises:

TypeError: Length is not an int ValueError: Length is not positive

__init__(mean: Optional[Union[float, int]] = None, length: int = 1) None

Methods

__init__([mean, length])

merge(other[, reverse])

Merge a trend into the current trend.

Attributes

length

mean

merge(other: trendlist.trendlist.Trend, reverse=False) Optional[trendlist.trendlist.Trend]

Merge a trend into the current trend.

Args:

other: A trend reverse: Merge decreasing trends.

Raises:

ValueError: self and other have same means.

Returns:

The merged trends if a merge is possible, None if not.