我有(2329452,41601)csr稀疏矩阵,如果我尝试添加一些cols,我得到ValueError,当它尝试将其转换为coo格式时:

E:\Anaconda3\lib\site-packages\scipy\sparse\coo.py in _check(self)
    230                 raise ValueError('row index exceeds matrix dimensions')
    231             if self.col.max() >= self.shape[1]:
--> 232                 raise ValueError('column index exceeds matrix dimensions')
    233             if self.row.min() < 0:
    234                 raise ValueError('negative row index found')

ValueError: column index exceeds matrix dimensions

好 . 我自己制作了新的crs矩阵:

<2532951x41665 sparse matrix of type '<class 'numpy.float64'>'
    with 27302250 stored elements in Compressed Sparse Row format>

但是当我在SGDClasifer中使用它时,我得到了长篇文章 . 在它结束时

ValueError: Last value of index pointer should be less than the size of index and data arrays

我检查了最后一个索引= 27302250,这与索引和数据数组的len相同 .

我有scipy,numpy,pandas和sklearn的最新版本