Skip to content
Advertisement

Find words in array and get their indexes in Dataframe in Pandas

I have a dataframe :

JavaScript

I need to find words from column token_1 in token_2 and get their indixes in an array. Then get a list of indexes for each line, i expected this:

JavaScript

Advertisement

Answer

Use list comprehension with enumerate for indices:

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