linopy.expressions.LinearExpression.sum

linopy.expressions.LinearExpression.sum#

LinearExpression.sum(dim=None, drop_zeros=False, **kwargs)#

Sum the expression over all or a subset of dimensions.

This stack all terms of the dimensions, that are summed over, together.

Parameters:
  • dim (str/list, optional) – Dimension(s) to sum over. The default is None which results in all dimensions.

  • dims (str/list, optional) – Deprecated. Use dim instead.

Returns:

linopy.LinearExpression – Summed expression.