According to the parameter documentation, the value parameter in set_attr can be int, float, str or Series.
However, the code only seems to allow Series and anything that can be a float. It fails when trying to set vtype (which is a str).
> vars["z"].gppd.set_attr("vtype", gp.GRB.CONTINUOUS)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[12], line 5
1 # change type of z from semi-integer to continuous
2 #for v in vars["z"]:
3 # v.vtype=gp.GRB.CONTINUOUS
----> 5 vars["z"].gppd.set_attr("vtype", gp.GRB.CONTINUOUS)
6 vars["z"].gppd.set_attr("lb", 0)
8 m.params.OutputFlag = 0
File ~/venvs/gurobi-finance/lib/python3.11/site-packages/gurobipy_pandas/accessors.py:330, in GRBSeriesAccessor.set_attr(self, attr, value)
328 entry.x.setAttr(attr, entry.v)
329 else:
--> 330 value = float(value)
331 for v in self._obj:
332 v.setAttr(attr, value)
ValueError: could not convert string to float: 'C'
According to the parameter documentation, the
value
parameter inset_attr
can be int, float, str or Series. However, the code only seems to allow Series and anything that can be a float. It fails when trying to set vtype (which is a str).