Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created January 28, 2018 07:47
Show Gist options
  • Select an option

  • Save dipanjanS/cf10b32330b533dd558b00da4c306a0f to your computer and use it in GitHub Desktop.

Select an option

Save dipanjanS/cf10b32330b533dd558b00da4c306a0f to your computer and use it in GitHub Desktop.
from sklearn.feature_extraction.text import TfidfVectorizer
tv = TfidfVectorizer(min_df=0., max_df=1., use_idf=True)
tv_matrix = tv.fit_transform(norm_corpus)
tv_matrix = tv_matrix.toarray()
vocab = tv.get_feature_names()
pd.DataFrame(np.round(tv_matrix, 2), columns=vocab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment