[Solved] python Error: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item()

Code that has error:

if (code in list(changed_code['Old material code'])): temp_index = changed_code.loc[changed_code['Old material code'] == code].index

The type of code is float

Cause of python Error: ValueError

In this code, the value cannot be of float type.

Solution for python Error: ValueError

You have to just convert float type into int type.

if (int(code) in list(changed_code['Old material code'])):
            temp_index = changed_code.loc[changed_code['Old material code'] == code].index

Also Read | [Solved] How to Solve Python picamera and raspistill error

Ranjeet Singh Rawat
Ranjeet Singh Rawat

Leave a Reply

Your email address will not be published. Required fields are marked *