<p>A = ((df['a'][-1:] + df['a'][1:])/2)</p><p>B = ((df['a'][-1:]+df['b'][-1:]+df['b'][-1:]+df['d'][-1:])/4)</p><p>if A < B</p><p>print(1)</p><p> </p><p>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</p>