TypeError: ufunc 'bitwise_and' not supported for the input types, and the inputs could not be safely
in
The Complete Data Visualization Course with Python, R, Tableau, and Excel
/
Line Chart - Python - How to Create a Line Chart
Hi hope someone know how to resolve this error.
1 answers ( 0 marked as helpful)
Hi Bernie,
thanks for reaching out! From the error I believe that the error comes from the order in which operations are performed in Python. & has a higher priority, compared to <=, that's why you get the error. If you add parentheses in the second comparison like so:
df_spx_ftse_H2_08 = df_spx_ftse_00_10[(df_spx_ftse_00_10.new_date >= '2008-07-01') &
(df_spx_ftse_00_10.new_date <= '2008-12-31')]
you should be alright.
As an aside, I always put parentheses when I have the & or | operator, just to be sure that everything is running smoothly. You'd be surprised how many potential errors you can avoid that way.
Let me know if that works for you.
Best,
365 Eli