Skip to content

handle exception divide by zero #5

@behnazpp

Description

@behnazpp

Hi
thanks for your nice code. in my series I have meny zeros. how to handle that when I want to calc error rate?
def __forecast_value(self, x1, a_value, b_value, k):
---> 21 return (1 - math.exp(a_value)) * (x1 - (b_value / a_value)) * math.exp(-a_value * k)
22
23 def __forecast(self, patterns, period=1):

ZeroDivisionError: float division by zero

I tried to shift the numbers and now the series dont have any zeros.
still exception below occure. do you know why?

ZeroDivisionError: float division by zero

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions