From 8f48a836a5fcd7785cc1c2c6abb14c35b265b639 Mon Sep 17 00:00:00 2001 From: Roberto <37729096+RobertoDF@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:15:40 +0200 Subject: [PATCH] fix for nans in table["color"].str.match(color_triplet_re) --- .../ecephys/ecephys_session_api/ecephys_nwb_session_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allensdk/brain_observatory/ecephys/ecephys_session_api/ecephys_nwb_session_api.py b/allensdk/brain_observatory/ecephys/ecephys_session_api/ecephys_nwb_session_api.py index de79a9bcc..8fab59cb6 100644 --- a/allensdk/brain_observatory/ecephys/ecephys_session_api/ecephys_nwb_session_api.py +++ b/allensdk/brain_observatory/ecephys/ecephys_session_api/ecephys_nwb_session_api.py @@ -90,7 +90,7 @@ def get_stimulus_presentations(self): # coded as rgb triplets and the other as -1 or 1 if "color_triplet" not in table.columns: table["color_triplet"] = pd.Series("", index=table.index) - rgb_color_match = table["color"].str.match(color_triplet_re) + rgb_color_match = table["color"].str.match(color_triplet_re).astype(bool) table.loc[rgb_color_match, "color_triplet"] = table.loc[ rgb_color_match, "color"] table.loc[rgb_color_match, "color"] = ""