Scipy fourier transform zero frequency spike (from DC offset) - de-meaning and hanning window have no effect
It doesn't happen with a random signal.  Your signal must have low frequency content around 0 Hz that shows up even after you've nulled out 0 Hz itself?
import numpy as np
from scipy import signal
from scipy import fft
import matplotlib.pyplot as plt

a = np.random.randn(174001)
a -= np.mean(a)

win = signal.hann(174001)
dt = 0.01
n = 174001

X = fft.fft(a*win, n=n)
freqs = fft.fftfreq(len(a), dt)
plt.plot(freqs, np.abs(X))
# plt.yscale(&quot;log&quot;)
plt.show()


If you zoom in on 0 Hz, I bet you can see that the 0 Hz spike itself goes away when you null out the mean, but the content around 0 Hz stays the same.