小编dic*_*119的帖子

桌上条纹的课没有给我其他颜色

我希望桌子能有多种颜色。但是,在应用表格条纹类之后,所有行都变为灰色。我试图加载v3和v4 boostrap css文件。而且仍然没有用。

html

    <table id="maxDiversificationTable" class="investmentTable table table-striped table-bordered table-hover table-fit" style="margin-top:-55%" >
        <thead>
            <tr style="color:#337AC7" >
                <th >Tickers</th>
                <th >Current Weight</th>
                <th >New Weight</th>
                <th >Conviction</th>                
            </tr>
        </thead>
        {% for tableData in dataSet %}
        <tbody>
            <tr>
                <td>{{tableData.tickers}}</td>
                <td>{{tableData.currentWeight}}</td>
                <td>{{tableData.newWeight}}</td>
                <td>{{tableData.conviction}}</td>
            </tr>
        </tbody>
        {% endfor %}

    </table>
Run Code Online (Sandbox Code Playgroud)

html css python django bootstrap-4

5
推荐指数
1
解决办法
763
查看次数

当我尝试使用 for 循环设置约束时,Scipy 优化未运行

我试图在使用 for 循环来设置约束的同时最小化目标函数,使得 x1 = x2 = ... xn。但是,优化似乎不起作用。即结束 x 仍然等于初始 x。我收到了“LSQ 子问题中的奇异矩阵 C”的错误消息。

covariance_matrix = np.matrix([[0.159775519, 0.022286316, 0.00137635, -0.001861736],
                     [0.022286316, 0.180593862, -5.5578e-05, 0.00451056], 
                     [0.00137635, -5.5578e-05, 0.053093075, 0.02240866], 
                     [-0.001861736, 0.00451056, 0.02240866, 0.053778594]]) 

x0 = np.matrix([0.2,0.2,0.3,0.4])


fun = lambda x: x.dot(covariance_matrix).dot(x.transpose())
cons = np.array([])
for i in range(0,x0.size-1):
    con = {'type': 'eq', 'fun': lambda x:  x[i] - x[i+1]}    
    cons = np.append(cons, con)

con = {'type': 'eq', 'fun': lambda x:  sum(x)-1}   
cons = np.append(cons, con) 

solution = minimize(fun,x0,method='SLSQP',constraints = cons)


solution message: …
Run Code Online (Sandbox Code Playgroud)

python optimization scipy

1
推荐指数
1
解决办法
1240
查看次数

标签 统计

python ×2

bootstrap-4 ×1

css ×1

django ×1

html ×1

optimization ×1

scipy ×1