0

i want to pos-tagging a dataset of .csv file. I create a function which i hope can return the value of the pos-tagged words. But the value that return , instead give a value of the row , it return all of the value on every row. What do i miss? Is it because of the datatype or sum? anyway , here's the code that i wrote

def postagging(text):
pos_emotion = ct.tag_sents([df.emotion])
return pos_emotion

df['pos_emotion'] = df['emotion'].apply(postagging)
df

and here's the result

the result

I'm sorry if i don't explain really clear, my english is not so good.

1 Answer 1

0

You are getting the same value because every time you are passing [df.emotion] that is entire column of the dataframe instead of text that will be the value you want to process.

if you want to do postagging for each row you should modify your function in the following way:

def postagging(text):
   pos_emotion = ct.tag_sents([text])
   return pos_emotion

hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.