python - TypeError: order 必须是 str,而不是 int
问题描述
M = Train.shape[1]
Theta = np.zeros((120,M))
for k in range(M):
temp = np.reshape(np.copy(Train[:,k]),(m,n))
tempSmall = resize(temp, (10, 12), anti_aliasing=True)
Theta[:,k] = np.reshape(tempSmall,120,1)
TypeError Traceback (最近一次调用最后) C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py in _wrapfunc(obj, method, *args, **kwds) 57 try: ---> 58 return bound(*args, **kwds) 59 除了 TypeError:
TypeError: order must be str, not int 在处理上述异常的过程中,又出现了一个异常:
完整追溯: https ://drive.google.com/file/d/1xJTVtDEl_boFGP2l2uv6WK0EeBCM1vfu/view ?usp=sharing
解决方案
上面的代码是通过用这个语法改变最后一行代码来解决的
Theta[:,[k]] = np.reshape(tempSmall,(120,1))
推荐阅读
- microsoft-teams - 无法将自定义应用添加到 Teams 管理员中的新自定义策略
- html - 在导航栏和页脚之间的主容器内填充
- html - 如何在 CSS 中使用 XML 中声明的特定属性来设计网站
- r - 在使用 auto.arima 时,我们得到了最好的 pd 和 q 值。有没有办法将这些值动态发送到 arima() 函数?
- android - TextView 不会以编程方式将高度更新为 wrap_content
- dialog - 十进制数字字段在 AEM 触摸 UI 对话框中不起作用
- kubernetes - 印花布在我有两个接口的节点上不起作用,谢谢
- pandas - 如何通过选择熊猫中的行来删除
- mysql - MAMP PRO MySQL“启动但不接受连接”
- c - 用 C 完成用户输入