📅  最后修改于: 2022-03-11 14:46:45.206000             🧑  作者: Mango
from sklearn.feature_extraction.text import TfidfVectorizer
tfidf = TfidfVectorizer(stop_words='english')
description = df['tokens'].astype(str)
dtm = tfidf.fit_transform(description)
dtm = pd.DataFrame(dtm.todense(), columns = tfidf.get_feature_names())
dtm.head()