Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
459 views
in Technique[技术] by (71.8m points)

Create Document Term Matrix from Dataframe in Python

I want to create a term matrix document to determine the keywords of a set of words based on the label.

My dataset looks like this.

  id   |                     description                                      |   severity  |
-------------------------------------------------------------------------------------------
10020  |    remotely deleting file opened editor                              | major       |
10021  |    setting editor color setting string requires application restart  | minor       |
100210 |    ant build files cleared platform restart                          | major       |

I want to create a term matrix document that looks like this.

        | major | minor |
------------------------
editor  |   1   |   1   |
restart |   1   |   1   |

1 is frequency from word, but I want to fill it with tfidf weight. Does anyone have any ideas?

question from:https://stackoverflow.com/questions/66066587/create-document-term-matrix-from-dataframe-in-python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...