skbio.diversity.alpha_diversity(metric, counts, ids=None, validate=True, **kwargs)[source]

Compute alpha diversity for one or more samples

State: Experimental as of 0.4.1.

  • metric (str, callable) – The alpha diversity metric to apply to the sample(s). Passing metric as a string is preferable as this often results in an optimized version of the metric being used.

  • counts (1D or 2D array_like of ints or floats) – Vector or matrix containing count/abundance data. If a matrix, each row should contain counts of OTUs in a given sample.

  • ids (iterable of strs, optional) – Identifiers for each sample in counts. By default, samples will be assigned integer identifiers in the order that they were provided.

  • validate (bool, optional) – If False, validation of the input won’t be performed. This step can be slow, so if validation is run elsewhere it can be disabled here. However, invalid input data can lead to invalid results or error messages that are hard to interpret, so this step should not be bypassed if you’re not certain that your input data are valid. See skbio.diversity for the description of what validation entails so you can determine if you can safely disable validation.

  • kwargs (kwargs, optional) – Metric-specific parameters.


Values of metric for all vectors provided in counts. The index will be ids, if provided.

Return type