Skip to content

Commit 2440b3a

Browse files
Fixing Mypy errors
1 parent 03ef646 commit 2440b3a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

malariagen_data/anoph/phenotypes.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ def _load_phenotype_data(
7070
# Apply simple filters
7171
if insecticide is not None:
7272
df_combined = df_combined[df_combined["insecticide"].isin(insecticide)]
73-
if dose is not None:
74-
df_combined = df_combined[df_combined["dose"].isin(dose)]
73+
74+
df_combined = df_combined[
75+
df_combined["dose"].isin(dose if isinstance(dose, list) else [dose])
76+
]
77+
7578
if phenotype is not None:
7679
df_combined = df_combined[df_combined["phenotype"].isin(phenotype)]
7780

@@ -171,7 +174,7 @@ def _create_phenotype_binary_series(self, df: pd.DataFrame) -> pd.Series:
171174
f"Expected values (case-insensitive): {list(phenotype_map.keys())}"
172175
)
173176
if "sample_id" in df.columns:
174-
binary_series.index = df["sample_id"]
177+
binary_series.index = pd.Index(df["sample_id"])
175178
else:
176179
warnings.warn(
177180
"Cannot set index to sample_id as it is missing from the input DataFrame."

0 commit comments

Comments
 (0)