AICoE / prometheus-anomaly-detector

A newer more updated version of the prometheus anomaly detector (https://github.com/AICoE/prometheus-anomaly-detector-legacy)
GNU General Public License v3.0
596 stars 150 forks source link

Pandas trips over NaN values #195

Open DrMurx opened 1 year ago

DrMurx commented 1 year ago

I've some series returning some NaN values which the pandas component can't process.

Seen on the latest docker image (SHA 7d8f3511ccd0)

 Traceback (most recent call last):
   File "/usr/lib64/python3.8/multiprocessing/pool.py", line 125, in worker
     result = (True, func(*args, **kwds))
   File "/usr/lib64/python3.8/multiprocessing/pool.py", line 48, in mapstar
     return list(map(*args))
   File "app.py", line 146, in train_individual_model
     predictor_model.train(
   File "/opt/app-root/src/model.py", line 31, in train
     self.metric += Metric(metric_data)
   File "/opt/app-root/lib64/python3.8/site-packages/prometheus_api_client/metric.py", line 72, in __init__
     self.metric_values = pandas.DataFrame(metric["values"], columns=["ds", "y"]).apply(
   File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/frame.py", line 8736, in apply
     return op.apply()
   File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/apply.py", line 688, in apply
     return self.apply_standard()
   File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/apply.py", line 805, in apply_standard
     results, res_index = self.apply_series_generator()
   File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/apply.py", line 821, in apply_series_generator
     results[i] = self.f(v)
   File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/apply.py", line 131, in f
     return func(x, *args, **kwargs)
   File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/tools/numeric.py", line 183, in to_numeric
     values, _ = lib.maybe_convert_numeric(
   File "pandas/_libs/lib.pyx", line 2347, in pandas._libs.lib.maybe_convert_numeric
 ValueError: Unable to parse string "NaN" at position 85489
vsheykin commented 1 year ago

Hi. I've got this error too.

Traceback (most recent call last): File "/usr/lib64/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, kwds)) File "/usr/lib64/python3.8/multiprocessing/pool.py", line 48, in mapstar return list(map(args)) File "app.py", line 146, in train_individual_model predictor_model.train( File "/opt/app-root/src/model.py", line 31, in train self.metric += Metric(metric_data) File "/opt/app-root/lib64/python3.8/site-packages/prometheus_api_client/metric.py", line 72, in init self.metric_values = pandas.DataFrame(metric["values"], columns=["ds", "y"]).apply( File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/frame.py", line 8736, in apply return op.apply() File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/apply.py", line 688, in apply return self.apply_standard() File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/apply.py", line 805, in apply_standard results, res_index = self.apply_series_generator() File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/apply.py", line 821, in apply_series_generator results[i] = self.f(v) File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/apply.py", line 131, in f return func(x, args, kwargs) File "/opt/app-root/lib64/python3.8/site-packages/pandas/core/tools/numeric.py", line 183, in tonumeric values, = lib.maybe_convert_numeric( File "pandas/_libs/lib.pyx", line 2347, in pandas._libs.lib.maybe_convert_numeric ValueError: Unable to parse string "NaN" at position 156 """

sesheta commented 1 year ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale