skbio.util.cardinal_to_ordinal#
- skbio.util.cardinal_to_ordinal(n)[source]#
Return ordinal string version of cardinal int n.
- Parameters:
- nint
Cardinal to convert to ordinal. Must be >= 0.
- Returns:
- str
Ordinal version of cardinal n.
- Raises:
- ValueError
If n is less than 0.
Notes
This function can be useful when writing human-readable error messages.
Examples
>>> from skbio.util import cardinal_to_ordinal >>> cardinal_to_ordinal(0) '0th' >>> cardinal_to_ordinal(1) '1st' >>> cardinal_to_ordinal(2) '2nd' >>> cardinal_to_ordinal(3) '3rd'