代码:做数据筛选,选定特定日期范围的数据
start_time = pd.Timestamp("20230205")
end_time = pd.Timestamp("20230315")
data = data[(data["ds"] >= start_time) and (data["ds"] <= end_time)]
报错信息:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
正确代码:用“&”代替“and”来做多条件筛选
start_time = pd.Timestamp("20230205")
end_time = pd.Timestamp("20230315")
data = data[(data["ds"] >= start_time) & (data["ds"] <= end_time)]