import xlrd, xlwt
import scipy as sp
import scipy.io
import pandas as pd
import matplotlib.pyplot as plt
import pylab
from scipy.sparse import csc_matrix
%matplotlib inline
FileString = r'/content/drive/MyDrive/Thesis/EXIOBASE_3rx_aggLandUseExtensions_2015_pxp.mat'
MRIO = scipy.io.loadmat(FileString)
Regions = MRIO['IO']['A']
IN: Regions
OUT: array([[<42800x42800 sparse matrix of type '<class 'numpy.float64'>'
with 5986549 stored elements in Compressed Sparse Column format>]],
dtype=object)
IN: Regions.todense()
OUT:
AttributeError Traceback (most recent call last)
<ipython-input-116-3ef413dd7ae9> in <module>()
----> 1 Regions.todense()
AttributeError: 'numpy.ndarray' object has no attribute 'todense'
我正在尝试将此稀疏矩阵从 MATLAB 文件转换为密集矩阵,因此我应用了 todense() 函数,但我不知道为什么它不起作用。您的帮助将不胜感激谢谢