When the input array is a real array, but the dtype argument is given to be complex, the nanstd and nanvar functions will give a ComplexWarning, even though the complex part is always zero. This is due to the line:
np.subtract(arr, avg, out=arr, casting='unsafe')
where arr is the original type, but avg the new (complex) type, which gives the warning.