linopy.expressions.LinearExpression.to_polars

linopy.expressions.LinearExpression.to_polars#

LinearExpression.to_polars()#

Convert the expression to a polars DataFrame.

The resulting DataFrame represents a long table format of the all non-masked expressions with non-zero coefficients. It contains the columns coeffs, vars, const. The coeffs and vars columns will be null if the expression is constant.

Returns:

df (polars.DataFrame)