Skip to content

Commit f326c03

Browse files
committed
Changed dataframes to use max() for domain counts and variable counts instead of sum()
1 parent 21be7dd commit f326c03

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hbgd_data_store_server/studies/dataframes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def get_counts_by_domain(df):
8181
"""
8282

8383
columns = ['study', 'study_label', 'domain_code', 'domain_label']
84-
df2 = df.groupby(columns, as_index=False)[["count", "subjects"]].sum()
84+
df2 = df.groupby(columns, as_index=False)[["count", "subjects"]].max()
8585

8686
return df2
8787

@@ -117,7 +117,7 @@ def get_variable_counts(df, var_lookup, domain_code):
117117

118118
df2 = df[domain_code].reset_index()
119119

120-
grouped = df2.groupby(['study', 'study_label', domain_code], as_index=False).sum()
120+
grouped = df2.groupby(['study', 'study_label', domain_code], as_index=False).max()
121121

122122
if len(grouped['count'].dropna()) == 0:
123123
return None

0 commit comments

Comments
 (0)