def make_b(a):
    b = np.zeros_like(a)
b[0] = 1
for i in range(1, len(a)):
    b[i] = min(b[i - 1], a[i - 1]) + 2
return b
df['b'] = make_b(df['a'].values)
Pandas: building a column with self-refrencing past values