typeddfs.matrix_dfs

DataFrames that are essentially n-by-m matrices.

Module Contents

class typeddfs.matrix_dfs.AffinityMatrixDf

A similarity or distance matrix. The rows and columns must match, and only 1 index is allowed.

__repr__(self) str
__str__(self) str
classmethod _check(cls, df: typeddfs.base_dfs.BaseDf)
classmethod get_typing(cls) typeddfs.df_typing.DfTyping
classmethod new_df(cls, n: Union[int, Sequence[str]] = 0, fill: Union[int, float, complex] = 0) __qualname__

Returns a DataFrame that is empty but valid.

Parameters
  • n – Either a number of rows/columns or a sequence of labels. If a number is given, will choose (str-type) labels β€˜0’, β€˜1’, …

  • fill – A value to fill in every cell. Should match self.required_dtype.

Raises
  • InvalidDfError – If a function in verifications fails (returns False or a string).

  • IntCastingNaNError – If fill is NaN or inf and self.required_dtype does not support it.

symmetrize(self) __qualname__

Averages with its transpose, forcing it to be symmetric.

class typeddfs.matrix_dfs.LongFormMatrixDf

A long-form matrix with columns β€œrow”, β€œcolumn”, and β€œvalue”.

classmethod get_typing(cls) typeddfs.df_typing.DfTyping
class typeddfs.matrix_dfs.MatrixDf

A dataframe that is best thought of as a simple matrix. Contains a single index level and a list of columns, with numerical values of a single dtype.

classmethod get_typing(cls) typeddfs.df_typing.DfTyping
classmethod new_df(cls, rows: Union[int, Sequence[str]] = 0, cols: Union[int, Sequence[str]] = 0, fill: Union[int, float, complex] = 0) __qualname__

Returns a DataFrame that is empty but valid.

Parameters
  • rows – Either a number of rows or a sequence of labels. If a number is given, will choose (str-type) labels β€˜0’, β€˜1’, …

  • cols – Either a number of columns or a sequence of labels. If a number is given, will choose (str-type) labels β€˜0’, β€˜1’, …

  • fill – A value to fill in every cell. Should match self.required_dtype. String values are

Raises
  • InvalidDfError – If a function in verifications fails (returns False or a string).

  • IntCastingNaNError – If fill is NaN or inf and self.required_dtype does not support it.