Issue
This question is not the duplicate of this, because only scipy.sparse.csr.csr_matrix type is not showing in variable explorer whereas any other code when executed shows successfully in variable explorer.
I tried restarting both Ipython kernel as well as Spyder along with 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
I can use the fea variable normally but I don't see it in variable explorer.
Edit:
looking at current Ipyhton active variables it shows fea as an variable.
In [6]:print(dir())
Out [6]:['TfidfVectorizer','fea','a_str','tfidf','df']
Solution
As Carlos commented above it worked, I needed to deselect the Exclude unsupported data types
option in spyder's variable explorer.
Answered By - Ankit Agrawal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.