From 95634118f004455c740540bebc6a1f85c096db83 Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Mon, 29 Jan 2024 10:42:58 -0800 Subject: [PATCH 1/3] checkpoint --- src/hdmf/common/table.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hdmf/common/table.py b/src/hdmf/common/table.py index 5eeedcd86..1fafafb3f 100644 --- a/src/hdmf/common/table.py +++ b/src/hdmf/common/table.py @@ -1101,6 +1101,9 @@ def __get_selection_as_df(self, coldata): id_index = coldata.pop('id') df_input = OrderedDict() for k in coldata: # for each column + for item in coldata[k]: + if type(item) == TermSetWrapper: + item = item.value if isinstance(coldata[k], np.ndarray) and coldata[k].ndim > 1: df_input[k] = list(coldata[k]) # convert multi-dim array to list of inner arrays elif isinstance(coldata[k], pd.DataFrame): From c7b54b249ab8f71bfca1df6ef9751d88b931a66d Mon Sep 17 00:00:00 2001 From: Matthew Avaylon Date: Mon, 29 Jan 2024 10:53:40 -0800 Subject: [PATCH 2/3] Update table.py --- src/hdmf/common/table.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/hdmf/common/table.py b/src/hdmf/common/table.py index 1fafafb3f..e038fda47 100644 --- a/src/hdmf/common/table.py +++ b/src/hdmf/common/table.py @@ -1101,9 +1101,17 @@ def __get_selection_as_df(self, coldata): id_index = coldata.pop('id') df_input = OrderedDict() for k in coldata: # for each column - for item in coldata[k]: - if type(item) == TermSetWrapper: - item = item.value + # Check for TermSetWrapper + resolve_data = [] + for i in range(len(coldata[k])): + item = coldata[k][i] + if isinstance(item, TermSetWrapper): + resolve_data.append(item.value) + else: + resolve_data.append(item) + if len(resolve_data) != 0: + coldata[k] = resolve_data + if isinstance(coldata[k], np.ndarray) and coldata[k].ndim > 1: df_input[k] = list(coldata[k]) # convert multi-dim array to list of inner arrays elif isinstance(coldata[k], pd.DataFrame): From 18e1c961721cac32917de644b32fd789106e4dfc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:53:46 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/hdmf/common/table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hdmf/common/table.py b/src/hdmf/common/table.py index e038fda47..810690bde 100644 --- a/src/hdmf/common/table.py +++ b/src/hdmf/common/table.py @@ -1111,7 +1111,7 @@ def __get_selection_as_df(self, coldata): resolve_data.append(item) if len(resolve_data) != 0: coldata[k] = resolve_data - + if isinstance(coldata[k], np.ndarray) and coldata[k].ndim > 1: df_input[k] = list(coldata[k]) # convert multi-dim array to list of inner arrays elif isinstance(coldata[k], pd.DataFrame):