Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
304 views
in Technique[技术] by (71.8m points)

python - can't find the right answer for "The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()."

I've googled it but couldn't find the right solution for my case. I made a function1 before the code below to get a result in a form of list. So basically, a[i] and a[i+1] are the list of numbers and strings. When I used for loop as below, it works just fine until it reaches 100. After that, it keeps showing the "The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()." I've changed the list to other forms to fix the problem, but it wouldn't work. I would really appreciate it if anyone could help me with it.

range_end=200
a=dict()
for i in range(0,range_end):
    if i == range_end:
        break
    else:
        a[i]=funcion1()   
        a[i+1]=function1()
        
        if a[i][3]==a[i+1][3]:  
            answer=a[i]
        elif a[i][3] < a[i+1][3]:
            answer=a[i]
        else:
            answer=a[i+1]
question from:https://stackoverflow.com/questions/65894257/cant-find-the-right-answer-for-the-truth-value-of-a-series-is-ambiguous-use-a

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...