Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to_dataframe for TermSetWrapper #1047

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/hdmf/common/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,17 @@ def __get_selection_as_df(self, coldata):
id_index = coldata.pop('id')
df_input = OrderedDict()
for k in coldata: # for each column
# 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):
Expand Down
Loading