-
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
AlignedDyanmicTable does not support [int, str] type slicing #651
Labels
category: bug
errors in the code or code behavior
Comments
30 tasks
oruebel
added a commit
that referenced
this issue
Jul 21, 2021
Smplify 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. - [X] Fix #646 by adding ``AlignedDynamicTable.get`` - [X] Fix #651 by updating ``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, repectively - [X] Add ``AlignedDynamicTable.get_colnames(...)`` functions to allow us to keep compliance of the ``colnames`` property with ``DynamicTable`` while providing an easy way to get the full list of column names. - [X] Set name of DataFrame in ``DynamicTable.to_dataframe()`` and ``DynamicTable.get`` - [X] Add helper functions to ``DynamicTable`` to deal with foreign columns: - [X] ``DynamicTable.get_foreign_columns`` to identify if the table contains ``DynamicTableRegion`` columns - [X] ``DynamicTable.has_foreign_columns`` to identify which columns are``DynamicTableRegion`` columns - [X] ``DynamicTable.get_linked_tables`` to retrieve all tables linked to either directly or indirectly from the current table via ``DynamicTableRegion`` - [x] Implement the same helper functions also for ``AlignedDynamicTable`` - [x] ``DynamicTable.get_foreign_columns`` to identify if the table contains ``DynamicTableRegion`` columns - [X] ``DynamicTable.has_foreign_columns`` to identify which columns are``DynamicTableRegion`` columns - [x] ``DynamicTable.get_linked_tables`` to retrieve all tables linked to either directly or indirectly from the current table via ``DynamicTableRegion`` - [X] Add new module ``hdmf.common.hierarchicaltable`` with helper functions to facilitate conversion of linked tables to a single Pandas dataframe. - [X] ``to_hierarchical_dataframe`` to merge linked tables into a single consolidated pandas DataFrame. - [X] ``drop_id_columns`` to remove "id" columns from a DataFrame. - [X] ``flatten_column_index`` to replace a ``pandas.MultiIndex`` with a regular ``pandas.Index`` - [x] Add test for DyanmicTableRegion pointing to AlignedDynamicTable to check that the all columns are used - [x] Add tests for hierarchicaltable.py for - [X] to_hierarchical_dataframe - [x] drop_id_columns - [x] flatten_column_index functions - [X] File issue tickets for open TODO items for future PRs - [X] ``to_hierarchical_dataframe`` should be updated to support resolution of more than one DynamicTableRegion column. See #649 - [x] Add tutorial for DynamicTableRegion and how to use for linking to tables and for creating linked tables. See #648
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
DynamicTable
uses the syntax
dt[int, str](i.e.,
dt[row_index, column_name]) to select a single cell from the table.
AlignedDynamicTablehowever currently only supports slicing with tuples of strings to select whole tables or columns, e.g.
at[category_name, columns_name]. To retrieve a single cell,
AlignedDynamicTablecurrently requires that the row index be listed last, e.g.,
at[category_name, columns_name, 0]For consistency with
DynamicTable,
AlignedDynamicTable`` should be updated to allow for selections of the form:[int, str]
(i.e.,[row_index, category_name]
) to select a single row of a category table[int, (str, str)]
(i.e., [row_index, category_name, column_name]``) to select a single cell of the table.[int, str, str]
should work the same as[int, (str, str)]
Checklist
The text was updated successfully, but these errors were encountered: