util.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:micom 作者: resendislab 项目源码 文件源码
def _format_min_growth(min_growth, species):
    """Format min_growth into a pandas series.

    Arguments
    ---------
    min_growth : positive float or array-like object.
        The minimum growth rate for each individual in the community. Either
        a single value applied to all individuals or one value for each.
    species : array-like
        The ID for each individual model in the community.

    Returns
    -------
    pandas.Series
        A pandas Series mapping each individual to its minimum growth rate.

    """
    try:
        min_growth = float(min_growth)
    except (TypeError, ValueError):
        if len(min_growth) != len(species):
            raise ValueError(
                "min_growth must be single value or an array-like "
                "object with an entry for each species in the model.")
    return pd.Series(min_growth, species)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号