Skip to content

Commit 1db9094

Browse files
committed
Ensure country and location are strings in pca.py (mypy)
1 parent 39c7e5c commit 1db9094

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

malariagen_data/anoph/pca.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,10 @@ def plot_pca_coords(
351351
data[y] = _jitter(data[y], jitter_frac)
352352

353353
# Convenience variables.
354-
data["country_location"] = data["country"] + " - " + data["location"]
354+
# Prevent lint error (mypy): Unsupported operand types for + ("Series[Any]" and "str")
355+
data["country_location"] = (
356+
data["country"].astype(str) + " - " + data["location"].astype(str)
357+
)
355358

356359
# Normalise color and symbol parameters.
357360
symbol_prepped = self._setup_sample_symbol(
@@ -455,7 +458,10 @@ def plot_pca_coords_3d(
455458
data[z] = _jitter(data[z], jitter_frac)
456459

457460
# Convenience variables.
458-
data["country_location"] = data["country"] + " - " + data["location"]
461+
# Prevent lint error (mypy): Unsupported operand types for + ("Series[Any]" and "str")
462+
data["country_location"] = (
463+
data["country"].astype(str) + " - " + data["location"].astype(str)
464+
)
459465

460466
# Normalise color and symbol parameters.
461467
symbol_prepped = self._setup_sample_symbol(

0 commit comments

Comments
 (0)