python - 二维矩阵python增量
问题描述
我正在尝试在 python 中创建一个函数,它将 2D 矩阵中的每个值增加 10%。
import numpy
def add_percent(mtrx):
for i in mtrx:
for j in i:
mtrx[i][j] += 1.1
test_mat = np.array([[86, 70, 80, 89],[92, 85, 87, 87],[73, 77, 94, 83]])
test_case = add_percent(test_mat)
它给我一个错误
解决方案
推荐阅读
- selenium-webdriver - 如何将 @FindBy 用于 driver.findElements(By.xpath(
) - javascript - 如何在elementor Popup中打开外部链接
- python - 无法在 Apple M1 上安装 python lib 'coremltools' - Python 3.9 版
- google-chrome - 是否有一种安全的方法可以在 google chrome 扩展程序中存储用户凭据
- ios - 如何从主屏幕隐藏我的应用程序
- postgresql - 无法获取 SP 的动态执行以返回 INOUT 参数
- python - 芹菜重试异常错误
- swift - Swift:当应用程序最小化时视图位置重置,然后回到前台
- javascript - 创建后如何在 Quill.js 中初始化语法模块
- android - Firebase 实时数据库统一