To fix the issue you can do The trick is to compare the elements individually rather than both at the same time, which is probably why you were getting the error.
final_out = 
for item1 in my_input:
my_output = 
for item2 in item1:
if item2 != '0' or item2 != '0':
will help you It appears that this may have been an error from using the 32-bit version of NumPy and not the 64 bit. For whatever reason, though the program has no problem keeping the array in memory, it trips up when writing the array to a file if the number of elements in the array is greater than 2^32.
python+numpy: why does numpy.log throw an attribute error if its operand is too big?
will be helpful for those in need The result of math.factorial(21) is a Python long. numpy cannot convert it to one of its numeric types, so it leaves it as dtype=object. The way that unary ufuncs work for object arrays is that they simply try to call a method of the same name on the object. E.g.
should help you out Really embarrassing. I really was running out of memory. I started top and watch all 256GB get consumed. Why I never checked that during all my investigation is a mystery to even myself. My apologies for overlooking the obvious.