-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add functionality for linked DynamicTables #645
Conversation
…ction of nested tables containing DynamicTableRegion columns
…m to_hierarchical_dataframe
…rIndex in to_hierarchical_dataframe
I made a few more comments. Otherwise, looks good to me |
…colnames and fix columns logic
Co-authored-by: Ryan Ly <[email protected]>
Co-authored-by: Ryan Ly <[email protected]>
Co-authored-by: Ryan Ly <[email protected]>
@rly thanks for the helpful code review! Your comments have helped clean up |
@rly I have now resolved all comments. Can you please have another look and approve the PR if it looks good. |
…edDynamicTable
…ble with DynamicTableRegion
@rly while adding another test to ensure
Those issues are now fixed as well. I think these should be last changes on this PR 🤞 |
Co-authored-by: Ryan Ly <[email protected]>
Co-authored-by: Ryan Ly <[email protected]>
@rly thanks for the additional comments. I have updated the source accordingly. |
Motivation
For the icephys work with NWB we would like to simplify interacting with DynamicTables that reference other tables via DynamicTableRegion, creating a collection of linked tables. In the ICEphys case this is a "simple" linear hierarchy of tables, but in principle a table may contain any number of DynamicTableRegion columns. This PR adds several functions to simplify introspection of linked DynamicTables and conversion to pandas DataFrames.
TODO
AlignedDynamicTable.get
AlignedDynamicTable.get
to support slicing with[int, (str, str)]
,[int, str, str]
, and[int, str]
to select a single cell or row of a category table, repectivelyAlignedDynamicTable.get_colnames(...)
functions to allow us to keep compliance of thecolnames
property withDynamicTable
while providing an easy way to get the full list of column names.DynamicTable.to_dataframe()
andDynamicTable.get
DynamicTable
to deal with foreign columns:DynamicTable.get_foreign_columns
to identify if the table containsDynamicTableRegion
columnsDynamicTable.has_foreign_columns
to identify which columns areDynamicTableRegion
columnsDynamicTable.get_linked_tables
to retrieve all tables linked to either directly or indirectly fromthe current table via
DynamicTableRegion
AlignedDynamicTable
DynamicTable.get_foreign_columns
to identify if the table containsDynamicTableRegion
columnsDynamicTable.has_foreign_columns
to identify which columns areDynamicTableRegion
columnsDynamicTable.get_linked_tables
to retrieve all tables linked to either directly or indirectly fromthe current table via
DynamicTableRegion
hdmf.common.hierarchicaltable
with helper functions to facilitate conversion of linked tables to a single Pandas dataframe.to_hierarchical_dataframe
to merge linked tables into a single consolidated pandas DataFrame.drop_id_columns
to remove "id" columns from a DataFrame.flatten_column_index
to replace apandas.MultiIndex
with a regularpandas.Index
to_hierarchical_dataframe
should be updated to support resolution of more than one DynamicTableRegion column. See Support multiple DynamicTableRegion when converting to a hierarchical dataframe #649Checklist
flake8
from the source directory.