在运行代码
print(train_df[(train_df['item_price'] < q1 - 1.5 * iqr) or (train_df['item_price'] > q3 + 1.5 * iqr)])
时会报错
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
原因不了解,只需将or改为 ∣ | ∣即可,好像进行条件筛选时不能用and和or,替换为 & \& &和 ∣ | ∣即可,对于not 尚不知用何方式替换
print(train_df[(train_df['item_price'] < q1 - 1.5 * iqr) | (train_df['item_price'] > q3 + 1.5 * iqr)])