jbn / ZigZag

Python library for identifying the peaks and valleys of a time series.
BSD 3-Clause "New" or "Revised" License
444 stars 178 forks source link

Exception ignored in: 'zigzag.core.identify_initial_pivot' ZeroDivisionError: float division #7

Closed NTNguyen13 closed 2 years ago

NTNguyen13 commented 4 years ago

Hi, thank you for great package.

I tried your package on my sample data, it runs fine without any problems, however, when dealing with real data, I have some datapoint equal to 0, which lead to the error:

Exception ignored in: 'zigzag.core.identify_initial_pivot' ZeroDivisionError: float division

Could you please help me to solve this problem? Many thanks

jbn commented 2 years ago

I'm not sure how to solve this. If your series had points [0.0 1.0] the increase is not defined. Automatic solutions would impose assumptions. I'd just add constant to the entire series to prevent <= 0.0