title: Efficient way to loop over Pandas Dataframe to make dummy variables (1 or 0 input)
body: <p>I'm learning data science and would like to make dummy variables for my dataset. </p>
  
  <p>I have a Dataframe that has "Product Category" column that is a list of matching categories looking like ["Category1", "Category2".."CategoryN"]</p>
  
  <p>I know that Pandas has nice function that makes dummy variables automatically (pandas.get_dummies) but in this case, I can't use it, I guess(?). </p>
  
  <p>I know how to loop over the each row to append 1 to matching elements of each columns.
  My current code is this:</p>
  
  <pre><code>for column_name in df.columns[1:]: #first column is "Product Category" and appended dummy columns (product category names) to the right previously
      for index, _ in enumerate(df[column_name][:10]): #limit 10 rows
          if column_name in df["Product Category"][index]:
              df[column_name][index] = 1    
  </code></pre>
  
  <p>However, the above code is not efficient and I cannot use it since I have more than 100,000 rows. I'd like to somehow do the operations on the whole array, but I can't figure out how to do it. </p>
  
  <p>Could someone help?</p>