Skip to content
Advertisement

How to assign an item in a pandas dataframe after checking for conditions?

I am iterating through a pandas dataframe (originally a csv file) and checking for specific keywords in each row of a certain column. If it appears at least once, I add 1 to a score. There are like 7 keywords, and if the score is >=6, I would like to assign an item of another column (but in this row) with a string (here it is “Software and application developer”) and safe the score. Unfortunately, the score is everywhere the same what I find hard to believe. This is my code so far:

JavaScript

Advertisement

Answer

You assign a constant onto the whole column here:

JavaScript

They are supposed to be:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement