Python Error: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Error Codes:
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 here is float.
Cause analysis:
In this judgment method, the judged value cannot be of float type.
Solution:
Just convert float format to int format
if (int(code) in list(changed_code['Old material code'])):
temp_index = changed_code.loc[changed_code['Old material code'] == code].index
Solve the problem, brothers, get better!!
Read More:
- Pandas ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.an
- [How to Fix]The truth value of a series is ambiguous
- Python Valueerror: cannot index with vector containing Na / Nan values
- How to Solve Python AttributeError: ‘dict’ object has no attribute ‘item’
- Python errors: valueerror: if using all scalar values, you must pass an index (four solutions)
- [Solved] ValueError: only one element tensors can be converted to Python scalars
- How to Solve Python Xlwt ValueError: More than 4094 XFs (styles)
- Python 3.X error: valueerror: data type must provide an itemsize
- Python: How to Delete Empty Files or Folders in the Directory
- Python ValueError: only 2 non-keyword arguments accepted
- Solve the error of panda index unalignable Boolean series provided as indexer
- python Use timeit Error: stmt is neither a string nor callable
- Python Error: ValueError: invalid literal for int() with base 16: ‘ ‘
- [resolution] str.contains() problem] valueerror: cannot index with vector containing Na/Nan values
- ValueError: Found array with dim 4. Estimator expected and ValueError: Expected 2D array, got 1D array i
- Python: How to Use try exception to Display Abnormal Error Information
- [Solved] python opencv Error: findContours() Can only use the Grayscale
- [Solved] PyInstaller Error: ValueError: too many values to unpack
- Python Use PIP to install pyinstaller Error [Solved]