scipy.sparse.csr.csr_matrix 未在变量资源管理器中显示

scipy.sparse.csr.csr_matrix not showing in variable explorer

这个问题不是 的重复问题,因为只有 scipy.sparse.csr.csr_matrix 类型没有显示在变量资源管理器中,而执行时的任何其他代码都在变量资源管理器中成功显示。

我尝试重新启动 Ipython 内核以及 Spyder 和 Anaconda。

In [1]:from sklearn.feature_extraction.text import TfidfVectorizer
In [2]:tfidf = TfidfVectorizer(stop_words = 'english',ngram_range = (1,2),min_df = 5,sublinear_tf = True)
In [3]:fea = tfidf.fit_transform(df['text']) #this returns a scipy.sparse.csr.csr_matrix type
In [4]:type(fea)
Out[4]:scipy.sparse.csr.csr_matrix
In [5]:a_str = "qwertyuiop" #this shows in variable explorer

我可以正常使用 fea 变量,但我在变量资源管理器中看不到它。

编辑:

查看当前 Ipyhton 活动变量,它显示 fea 作为变量。

In [6]:print(dir())
Out [6]:['TfidfVectorizer','fea','a_str','tfidf','df']

正如卡洛斯在上面评论的那样,我需要在 spyder 的变量浏览器中取消选择 Exclude unsupported data types 选项。