TableDisplayο
- class bapsflib.utils.TableDisplay(rows: List[List[str]], headers: List[str] | None = None)ο
Bases:
objectClass designed to generated the brief summary tables used in the
__str__and__repr__methods ofHDFMapDigitizersandHDFMapControls.- Parameters:
rows (List[List[str]]) β List of table rows where each row is a list of strings being the contents of the associated row-column cell. For example,
rows[4][3]would be the cell contents of row 5 and column 4.headers (List[str]) β List of strings specifying the table column headers.
Noneif table has no headers. (DEFAULT:None)
Attributes Summary
List of cell widths of the table.
List of table headers.
Number of columns in the table.
Number of rows in the table, excluding headers.
List of table rows where each row is a list of strings being the contents of the associated row-column cell.
Methods Summary
auto_insert_horizontal_dividers(on_columns)Automatically insert horizontal dividers into the table based on cell value switching in columns specified by
on_columns.Generate and return the string contain the table associated with
rowsandheaders.Attributes Documentation
- headersο
List of table headers. Length equal to the number of columns,
ncols.Noneif table has no headers.
- ncolsο
Number of columns in the table.
- nrowsο
Number of rows in the table, excluding headers.
- rowsο
List of table rows where each row is a list of strings being the contents of the associated row-column cell.
For example,
rows[4][3]would be the cell contents of row 5 and column 4.
Methods Documentation
- auto_insert_horizontal_dividers(on_columns: List[int])ο
Automatically insert horizontal dividers into the table based on cell value switching in columns specified by
on_columns. Cell βswitchingβ corresponds to when a cell value switches from being empty to non-empty as moving down a column. The horizontal divider will be inserted above the non-empty cell from the associated column to the end of the table.- Parameters:
on_columns (List[int]) β List of column indices to be used for determining where to insert the horizontal divider.