stock_data.loc[khj_position[(khj_position == True) & (khj_position.shift() == False)].index,'KDJ_金叉死叉'] = '金叉'
stock_data.loc[khj_position[(khj_position == False) & (khj_position.shift() == True)].index,'KDJ_金叉死叉'] = '死叉'
这两行代码是否存在问题?
好像 khj_position == True & khj_position.shift() == False 不能进行bool运算
我这边提示:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
请高人指点
|