python - Sorting TfidfVectorizer output by tf-idf (lowest to highest and vice versa) -




i'm using tfidfvectorizer() sklearn on part of text data sense of term-frequency each feature (word). current code following

from sklearn.feature_extraction.text import tfidfvectorizer tfidf = tfidfvectorizer(analyzer='word', stop_words = 'english')  # fit_transform on training data x_traintfidf = tfidf.fit_transform(x_train) 

if want sort tf-idf values of each term in 'x_traintfidf' lowest highest (and vice versa), say, top10, , make these sorted tf-idf value rankings 2 series objects, how should proceed last line of code?

thank you.

i reading similar thread couldn't figure out how it. maybe able connect tips shown in thread question here.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -