SolarArbiter / solarforecastarbiter-api

HTTP API and database schema for the Solar Forecast Arbiter
https://api.solarforecastarbiter.org
MIT License
10 stars 6 forks source link

Non-Numeric NaN values cause aggregate resampling to crash. #296

Closed sentry-io[bot] closed 3 years ago

sentry-io[bot] commented 3 years ago

Data read from the database contains None as the nan value in the dataframe. The Core compute_aggregation function chokes when pandas does not know what to do with this Non-numeric type. Sentry Issue: API-5K

DataError: No numeric types to aggregate
(7 additional frame(s) were not displayed)
...
  File "flask/views.py", line 163, in dispatch_request
    return meth(*args, **kwargs)
  File "sfa_api/aggregates.py", line 189, in get
    aggregate['aggregate_type'], aggregate['observations'])
  File "solarforecastarbiter/utils.py", line 156, in compute_aggregate
    new_val = resampler['value'].mean().reindex(new_index)
  File "pandas/core/groupby/groupby.py", line 1225, in mean
    "mean", alt=lambda x, axis: Series(x).mean(**kwargs), **kwargs
  File "pandas/core/groupby/groupby.py", line 907, in _cython_agg_general
    raise DataError("No numeric types to aggregate")