typeddfs.matrix_dfsο
DataFrames that are essentially n-by-m matrices.
Module Contentsο
- class typeddfs.matrix_dfs.AffinityMatrixDf(data=None, index=None, columns=None, dtype=None, copy=False)ο
A similarity or distance matrix. The rows and columns must match, and only 1 index is allowed.
- __repr__() strο
Return repr(self).
- __str__() strο
Return str(self).
- classmethod _check(df: typeddfs.base_dfs.BaseDf)ο
Should raise an
typeddfs.df_errors.InvalidDfErroror subclass for issues.
- classmethod get_typing() typeddfs.df_typing.DfTypingο
- classmethod new_df(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
verificationsfails (returns False or a string).IntCastingNaNError β If
fillis NaN or inf andself.required_dtypedoes not support it.
- symmetrize() __qualname__ο
Averages with its transpose, forcing it to be symmetric.
- class typeddfs.matrix_dfs.LongFormMatrixDf(data=None, index=None, columns=None, dtype=None, copy=False)ο
A long-form matrix with columns βrowβ, βcolumnβ, and βvalueβ.
- classmethod get_typing() typeddfs.df_typing.DfTypingο
- class typeddfs.matrix_dfs.MatrixDf(data=None, index=None, columns=None, dtype=None, copy=False)ο
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() typeddfs.df_typing.DfTypingο
- classmethod new_df(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
verificationsfails (returns False or a string).IntCastingNaNError β If
fillis NaN or inf andself.required_dtypedoes not support it.