Skip to content

Commit 232eea7

Browse files
committed
fix FutureWarning and DeprecationWarning
1 parent 995b8dd commit 232eea7

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

iglu_python/pgs.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ def pgs_single(subj_data: pd.DataFrame) -> float:
129129

130130

131131
# Calculate PGS for each subject
132-
result = data.groupby("id").apply(lambda x: pgs_single(x), include_groups=True).reset_index()
133-
result.columns = ["id", "PGS"]
134-
135-
return result
132+
results = []
133+
for subject_id in data["id"].unique():
134+
subject_data = data[data["id"] == subject_id].copy()
135+
pgs_value = pgs_single(subject_data)
136+
results.append({"id": subject_id, "PGS": pgs_value})
137+
138+
return pd.DataFrame(results)

0 commit comments

Comments
 (0)