python - 如何在浮点数组中找到“dtype('O')”?
问题描述
在尝试从 a 构造 acsr_matrix
时array
,我收到此错误:
In [83]: np.info(urt[0,0])
float(x) -> floating point number
Convert a string or number to a floating point number, if possible.
In [84]: np.info(urt)
class: ndarray
shape: (18586, 18586)
strides: (148688, 8)
itemsize: 8
aligned: True
contiguous: True
fortran: False
data pointer: 0xa85bf0040
byteorder: little
byteswap: False
type: object
In [84]: csr_matrix(urt)
...
TypeError: no supported conversion for types: (dtype('O'),)
这大概是因为,在某处,array
出现了某种for的数组协议 ( dtype
) *。'O'
Object
所以我需要在构建csr_matrix
. 因此我的问题是,我怎样才能Object
在array
其他包含float
的 s 中找到 ?
*我不知道如何Object
偷偷进入,array
但我怀疑它可能是一个任意精度数。
解决方案
推荐阅读
- coq - Coq:本地 ltac 定义
- android - Android指纹扫描仪无法识别
- python - 如何打印整个稀疏矩阵?
- swift - 将数据从一个视图控制器传递到另一个显示 nil
- python - 如何将uint64转换为十六进制
- dart - 如何在 Dart 中使用身份验证连接 TCP Socket 服务器客户端
- javascript - 当父组件中的对象属性更改时如何更新子组件中的对象
- arrays - Swift:对字符串数组进行排序......或多或少的数字
- php - 是否真的有必要对来自另一个查询的可信数据的预准备语句?
- ms-access - 使用批处理文件打开时运行 Access 宏