Created
May 18, 2020 02:16
-
-
Save importdata/f3ba5ce430f2617a50f66829942e2d97 to your computer and use it in GitHub Desktop.
Kaggle Twitter Data CountVectorizer Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document = ["This is Import Data's YouTube channel", | |
"Data Science is my passion and it is fun", | |
"Please subscribe to my channel"] | |
# create the transform | |
vectorizer = CountVectorizer() | |
# tokenize and make the document into a matrix | |
doc_term_matrix = vectorizer.fit_transform(document) | |
pd.DataFrame(doc_term_matrix.toarray(),columns = vectorizer.get_feature_names()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment