Skip to content

Commit

Permalink
Add error handling for missing data in eirgrid ingestion function
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewm4894 committed Dec 30, 2024
1 parent 10f13b2 commit d10ea5c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions metrics/examples/eirgrid/eirgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ def ingest() -> pd.DataFrame:

def make_df(data) -> pd.DataFrame:

if 'Rows' not in data:
print('No data found')
print(data)
return pd.DataFrame()

df = pd.DataFrame(data['Rows'])
df = df[['EffectiveTime', 'FieldName', 'Value']]
df.columns = ['metric_timestamp', 'metric_name', 'metric_value']
Expand Down

0 comments on commit d10ea5c

Please sign in to comment.