I have a DF as follows:
d1=pd.DataFrame({'a':[0,1,0,1,2,4,5,1,7,8,0],'b':[0,1,2,4,5,7,1,3,1,0,1]})
I want to produce a new column called 'new' that is based on the maximum of column a and the previous row's value of column b (i.e. 'b' shift()).
I tried doing the follow:
df'[new']=df[['a',df['b'].shift()]].max(axis=1)
Yet I get some mutable error message.
My desired output is as follows:

