0

I have a dataframe of two columns [Consolidated SKU] and [GAP SKU] I wanna use a For Loop as well as If statement to check each value of GAP SKU and see if its in Consoludated SKU. If it is then in the adjacent cell so a third column [True/False] it will insert True or False. What I have so far is this

for x in df['GAP SKU']:
     if x in df['Consolidated SKU']:

I just dont know how to access the adjacent column. Any help would be appreciated!

James Rush
  • 13
  • 2
  • 1
    1) No, you don't want to use a for loop. Looping and pandas are pretty much never the right answer. – BeRT2me Oct 11 '22 at 16:59
  • 1
    2) What do you mean by "`GAP SKU` is in `Consolidated SKU`", do you mean if `GAP SKU` is in ANY value of the `Consolidated SKU` column, or do you mean if it's in the `Consolidated SKU` of the same row? – BeRT2me Oct 11 '22 at 16:59
  • 1
    3) Please include a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) | [Pandas MRE](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – BeRT2me Oct 11 '22 at 16:59

0 Answers0