擅长:python、mysql、java
<p>如果使用python3.6或更高版本,可以利用Python的<a href="https://realpython.com/python-f-strings/" rel="nofollow noreferrer">f-strings</a>更干净的字符串插值语法。在</p>
<pre><code>constraint_str = f"SIZE*{int(SectorWgt.iloc[0])}+VQMadj*{int(SectorWgt.iloc[1])}"
results = model.fit_constrained(constraint_str)
</code></pre>