Skip to content

Commit bbc6615

Browse files
committed
Sum by loss type instead of by aggby
1 parent e0e64c2 commit bbc6615

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

openquake/calculators/extract.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,8 @@ def extract_aggrisk_tags(dstore, what):
898898
for qfield, qvalue in zip(qfields, qvalues):
899899
acc[qfield].append(qvalue)
900900
df = pandas.DataFrame(acc)
901-
total_df = df.groupby(aggby, as_index=False).sum()
902-
total_df['loss_type'] = 'total'
901+
total_df = df.groupby('loss_type', as_index=False).sum()
902+
total_df[aggby] = 'total'
903903
df = pandas.concat([df, total_df], ignore_index=True)
904904

905905
return df

openquake/qa_tests_data/event_based_risk/case_1/expected/aggrisk_tags.csv

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@ B,RM,nonstructural,2.50000E+03,9.44013E+01
77
B,RM,structural,5.00000E+03,3.55602E+02
88
B,W,nonstructural,5.00000E+02,2.60544E+01
99
B,W,structural,1.00000E+03,2.52457E+02
10-
A,RC,total,3.00000E+03,8.89886E+01
11-
A,RM,total,4.50000E+03,1.64871E+02
12-
B,RM,total,7.50000E+03,4.50003E+02
13-
B,W,total,1.50000E+03,2.78511E+02
10+
total,total,nonstructural,5.50000E+03,1.69074E+02
11+
total,total,structural,1.10000E+04,8.13301E+02

0 commit comments

Comments
 (0)