I just discovered a logical bug in my code which was causing all sorts of problems. I was inadvertently doing a bitwise AND instead of a logical AND
if you work with pandas what solved the issue for me was that i was trying to do calculations when I had NA values, the solution was to run:
pandas
df = df.dropna()
And after that the calculation that failed.