hpmcm.table module

class hpmcm.table.TableColumnInfo(dtype, msg)[source]

Bases: object

Helper class to manage a column in a table

This provides a mechanism to document the column in the class docstring, and to validate input data

Parameters:
  • dtype (type)

  • msg (str)

validate(val)[source]

Validate data used to fill a column is of the correct type

Return type:

None

Parameters:

val (ndarray)

class hpmcm.table.TableInterface(df=None, **kwargs)[source]

Bases: object

Table Schema

Parameters:
  • df (pandas.DataFrame | None)

  • kwargs (Any)

property data: DataFrame

Return the underlying data

classmethod emtpyNumpyDict(n)[source]

Create a dict of empty numpy arrays

Return type:

dict[str, ndarray]

Parameters:

n (int)

Parameter

n:

Length of the arrays

classmethod read(file_path, extra_cols)[source]

Read a dataframe from a file

Return type:

DataFrame

Parameters:
  • file_path (str)

  • extra_cols (list[str])

classmethod toPandas(**kwargs)[source]

Convert data to a pandas DataFrame

Return type:

DataFrame

Parameters:

kwargs (Any) – The input data

classmethod validate(**kwargs)[source]

Validate that data match the schema

Return type:

None

Parameters:

kwargs (Any) – The input data

Raises:
  • ValueError: – The number of columns don’t match the schema

  • KeyError: – An input column is not in the schema