mooonpy.tools.tables module
- class mooonpy.tools.tables.ArrayTable(from_numpy=None, shape=None, collabels=None, rows=None, title=None, cornerlabel=None, default=Ellipsis)[source]
Bases:
Table
- class mooonpy.tools.tables.ColTable(from_dict=None, rows=None, title=None, cornerlabel=None, default=Ellipsis)[source]
Bases:
Table
- class mooonpy.tools.tables.ListListTable(from_listlist=None, shape=None, collabels=None, rows=None, title=None, cornerlabel=None, default=Ellipsis)[source]
Bases:
Table
- class mooonpy.tools.tables.Table(title=None, cornerlabel=None, default=Ellipsis)[source]
Bases:
object
The Table object takes several form-factors of the underlying data structure implemented in its subclasses. The main class is a dummy for storage but handles IO to csv or text. Methods are developed so access can be aliased for any of the subclasses. Or the .grid attribute can be used for direct access on specific subclasses.
- def shape(self) -> Tuple[Optional[int], Optional[int]]:
‘’’ Size of the grid attribute, similar to numpy’s .shape attribute. If one item in the tuple is None, the grid is asymmetric or does not match the labels and shape is meaningless. ‘’’ return tuple((0,0)) # makes code happy
- def headers(self) -> Optional[List[str]]:
‘’’ Return a list of keywords or headers of the table ‘’’ pass
- def rowlabels(self) -> Optional[List[str]]:
‘’’ Returns a list of row labels of the table ‘’’ pass
- def col(self,key):
‘’’ Returns column from index of ‘key’ in headers, or if not found, index of the header if that fails, a column of appropriate length is created with .default ‘’’ pass
- def row(self,row_key):
‘’’ Returns a row from the index of ‘row_key’ in rows, or if not found is used as the index This has O(N) cost if using ‘rowlabel’ as a list, or O(1) cost without the list ‘’’ pass
- def rowcol(self,row_key,key):
pass
- col_fun(fun_name: str) Dict | List [source]
Compute aggregate functions on each column.
The result is added to the summary dict as a ‘fun_name’:dict(key:value,…)
pair if keywords are defined, or a list(value,…) if not.
note that the summary dict may be converted to a RowTable
RowTable does not exist yet
The data is also returned.