The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

前端 未结 1 481
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 08:21

my inputs are, data input at top

Date        Time    Open    High    Low    Close    Volume
02/01/2015  14:30   79.52   79.73   79.52   79.71   10841
02/01/2015          


        
相关标签:
1条回答
  • 2021-01-29 08:53

    The error you're seeing is correct. dHaGreen0 is an array of bool values. When you ask "dHaGreen0 == True", you need to decide on one of the two following interpretations:

    Do you mean if any value is dHaGreen0 is True? If so, replace "dHaGreen0 == True" with "any(dHaGreen0) == True".

    Or do you mean if all values in dHaGreen0 are True? If so, replace "dHaGreen0 == True" with "all(dHaGreen0) == True".

    Similarly for dHaGreen1

    If you're trying to do this for each pair:

    dPosition = dHaGreen0 & dHaGreen1
    

    This will then give you an array of booleans giving the result for each pair.

    0 讨论(0)
提交回复
热议问题