Commit 55f4f3b
committed
fix: resolve NumPy 2.x boolean ambiguity in SNP frequency analysis
Replace built-in all() with .all() method on pandas Series in
_prep_samples_for_cohort_grouping() to avoid NumPy 2.x ValueError.
NumPy 2.x raises ValueError when attempting to evaluate the truth value
of an array/Series with more than one element in a boolean context.
Before:
if not all(df_samples[period_by].apply(...)):
After:
if not df_samples[period_by].apply(...).all():
The .all() method correctly reduces the Series to a single boolean value,
maintaining identical behavior with both NumPy 1.26.x and 2.x.
Fixes allele_frequencies_advanced test failures under NumPy 2.x.1 parent 8aa3891 commit 55f4f3b
1 file changed
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
| |||
0 commit comments