Feel like I\'ve looked just about everywhere and I know its probably something very simple. I\'m working with a pandas dataframe and looking to fill/replace data in one of
using Where
df['B'] = df.A[0:len(df.A)-1].where((df.A==0 ) & (df.B.shift(-1)==-1),-1) df['B'] = df['B'].fillna(df.A)