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)
评论列表
文章目录