

def _validate_counts_vector(counts, suppress_cast=False):
    'Validate and convert input to an acceptable counts vector type.\n\n    Note: may not always return a copy of `counts`!\n\n    '
    counts = np.asarray(counts)
    if (not suppress_cast):
        counts = counts.astype(int, casting='safe', copy=False)
    if (counts.ndim != 1):
        raise ValueError('Only 1-D vectors are supported.')
    elif (counts < 0).any():
        raise ValueError('Counts vector cannot contain negative values.')
    return counts

dataset/ETHPy150Open biocore/scikit-bio/skbio/diversity/_util.py _validate_counts_vector/original