skbio.stats.ordination.OrdinationResults.rename#

OrdinationResults.rename(mapper, matrix='samples', strict=True)[source]#

Rename sample or feature IDs in the data matrix.

Parameters:
mapperdict or callable

A dictionary or function that maps current IDs to new IDs.

matrixstr, optional

Specifies which matrix contains the IDs to be renamed. Either “samples” (default) or “features”.

strictbool, optional

If True (default), every ID in the matrix must be included in mapper. If False, only the specified IDs will be renamed.

Raises:
ValueError

If mapper does not contain all of the same IDs in the matrix whereas in strict mode.

ValueError

If renaming features but self does not contain features.

ValueError

If matrix is neither “samples” nor “features”.