【发布时间】:2022-08-16 21:49:48
【问题描述】:
0
`vectorizer = TfidfVectorizer(analyzer=\'word\',norm=None, use_idf=True,smooth_idf=True) tfIdfMat = vectorizer.fit_transform(df[\'Description\']) feature_names = sorted(vectorizer.get_feature_names())
docList=[\'df.Description\'] #skDocsTfIdfdf = pd.DataFrame(tfIdfMat.todense(),index=sorted(docList), columns=feature_names) #print(skDocsTfIdfdf)
对于 tfIdfMat.nonzero()[1] 中的 col:打印 (feature_names[col], \'-\' , tfIdfMat[0, col])`
标签: python sqlalchemy