Python解决The truth value of a Series is ambiguous.md


import pandas as pd
data = pd.read_csv('x.csv')
print data[data['l']>1 and data['l']<20]

出现错误“ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().”

把and换成 & ,并使用()把各个条件括起来