Skip to content

Commit

Permalink
Correct add 2 more cols to analyse incidents.
Browse files Browse the repository at this point in the history
  • Loading branch information
gnrgomes committed Jun 14, 2024
1 parent 105cdcc commit 1860578
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lisfloodutilities/gridding/tools/analyse_incidents.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def run(infolder: str, outfolder: str):
df[incident_type] = None
df[incident_type] = df.apply(get_total_incident_by_type, axis=1, incident_type=incident_type)

df = df.groupby(COL_PROVIDER_ID).agg(agg_funcs).reset_index()
groupy_cols = [COL_PROVIDER_ID, COL_PARAMETER, COL_TIMESERIES]
df = df.groupby(groupy_cols).agg(agg_funcs).reset_index()

# Eliminate the top level of column names since the new names are
# written on the bottom level and insert the name of the the
Expand All @@ -127,6 +128,8 @@ def run(infolder: str, outfolder: str):
df.reset_index(drop=True, inplace=True)
columns = list(df.columns)
columns[0] = 'Provider'
columns[1] = COL_PARAMETER
columns[2] = COL_TIMESERIES
df.columns = columns

df['Incidents per Station'] = df['Total Incidents'].div(df['Number of Stations'])
Expand Down

0 comments on commit 1860578

Please sign in to comment.