1
Vendors = ['APPLE', 'MICROSOFT', 'CISCO']

I want to populate the IsVendor column. What is the most efficient and simplest way to do that without using loops or lambda.apply?

I have 1.2 million rows, each row needs to be checked against a list of 200K vendors so efficiency is paramount. Ideally I'd like to use a simple to understand method as much as possible.

I've heard that numpy is super fast but not sure how to use it in this situation.

I'm grateful for your help! Thanks

enter image description here

Chadee Fouad
  • 2,630
  • 2
  • 23
  • 29
  • do following `pattern='|'.join(vendors) data["new col"]=data["A"].str.contains(pattern)` – SMS Dec 11 '19 at 08:56

0 Answers0