mardi 1 février 2022

To search the column title in the value (pos_tag value) of dataframe python and if it's matched put 1 else 0 as column value

Dear Python community,

I am writing a python script to perform prediction using Naive Bayes, SVM, and Decision Tree supervised learning. I already completed all the data preprocessing until getting the prediction from the data that I have.

However, there is a need to add a few new columns (name, value) in the data frame as below.

enter image description here

My issue is I need to check if the column name (e.g. excellent, strip, male) exists in the pos_tag_noun's value, the value in those new columns set to 1, else put 0 as shown below.

enter image description here

I have been working for two days to resolve this issue but still not able to have a solution for it.

Really appreciated for help if any idea or solution to resolve my issue.

Thanks & Regards

Aucun commentaire:

Enregistrer un commentaire