0

I've perused some similar questions regarding UFuncTypeError but can't use that information to deduce what is wrong with my code in particular. Here's my code:

UFuncTypeError                            Traceback (most recent call last)
Cell In[6], line 148
    145 print('Status Update: Fitting Anodic Sweep #',anodic_count,'...')
    147 # define the explicit ranges of voltages to start and end at
--> 148 start_band = [V for V in full_range_V if (V >= Vstart_a_anodic and V <= Vstart_b_anodic)]    
    149 end_band = [V for V in full_range_V if (V >= Vend_a_anodic and V <= Vend_b_anodic)]
    151 # iterate over each possible start and endpoint for the fit

Cell In[6], line 148, in <listcomp>(.0)
    145 print('Status Update: Fitting Anodic Sweep #',anodic_count,'...')
    147 # define the explicit ranges of voltages to start and end at
--> 148 start_band = [V for V in full_range_V if (V >= Vstart_a_anodic and V <= Vstart_b_anodic)]    
    149 end_band = [V for V in full_range_V if (V >= Vend_a_anodic and V <= Vend_b_anodic)]
    151 # iterate over each possible start and endpoint for the fit

UFuncTypeError: ufunc 'less_equal' did not contain a loop with signature matching types (<class 'numpy.dtypes.Float64DType'>, <class 'numpy.dtypes.StrDType'>) -> None 

I tried to have the program read a potential range in an excel document and use it as framework for my lab software.

azro
  • 53,056
  • 7
  • 34
  • 70
Justin
  • 1
  • The error typically means you're comparing a floating point number with a string. What are the types of the elements of full_range_V. What is the type of Vstart_a_anodid and Vstart_b_anodic? – Frank Yellin Jul 03 '23 at 14:15
  • Hey Frank, I realized that the txt document I had the code reading had extra characters in the beginning. This was because I used a different machine than usual so when the code tried to scan for numeric values it was running into text and resulted in me geting the error shown above. Thanks for taking your time to respond to my issue! – Justin Jul 04 '23 at 20:49

0 Answers0