【发布时间】:2019-05-04 08:47:23
【问题描述】:
专家,
我遇到了 Pandas 的问题..
不确定为什么不满足以下条件。
df = pd.read_csv(path + filename, index_col='Date', parse_dates=True)
for i in range(1, len(signal)):
if [(df['x'] < 2) & (df['y'] <= 0)]:
listLongShort1.append("A_Condition")
# The other way around
elif [(df['x'] > 3) & (df['y'] >= 1)]:
listLongShort1.append("B_Condition")
else:
listLongShort1.append("No Condition")
它只是打印带有“A_Condition”的填充列,由于某种原因没有看到 elif 或其他。
您能告诉我我的代码有什么问题吗?
谢谢!!
【问题讨论】:
标签: python-3.x dataframe pandas-datareader