Mar-24-2020, 08:14 PM
import pandas as pd words = [ "robot", "automation", "collaborative", "Artificial Intelligence", "technology", "Computing", "autonomous", "automobile", "cobots", "AI", "Integration", "robotics", "machine learning", "machine", "vision systems", "systems", "computerized", "programmed", "neural network", "tech", ] data = [ [ "robotm, automation, collaborative ,Artificial, Intelligence, technology, Computing, autonomous ,automobile, cobots, AI, Integration, robotics ,machine learning, machine, vision systems, systems, computerized, programmed, neural network, tech" ], [ "robotm, automation, collaborative ,Artificial, Intelligence, technology, Computing, autonomous ,automobile, cobots, AI, Integration, robotics ,machine learning, machine, vision systems, systems, computerized, programmed, neural network, tech, hello, lala, hi, cat" ], [ "dog, bird, cards, pet, mama, robotm, automation, collaborative ,Artificial, Intelligence, technology, Computing, autonomous ,automobile, cobots, AI, Integration, robotics ,machine learning, machine, vision systems, systems, computerized, programmed, neural network, tech, fish, ocean, river, sky" ], ] df = pd.DataFrame(data, columns=["text"]) count = 0 for text in df["text"].iteritems(): if words in text: count += 1 print(count) # output goal # index[0]: 10 # index[1]: 13 # index[2]: 15
Output:blank