-1

I have some time series that I want to give as input for the autoencoder. They have different lengths and I want to zero padding them to have the same length. What is the best way in python? I am using np.append like this:

z= np.zeros(36000, dtype='int32')
st[0].data= np.append (st[0].data, z)

But the problem is that when the value of the time series suddenly changes to zero, it shows a high peak in after filtering and in the frequency domain.

I have found out that the below function is for zero padding and it has different mode to use:

np.pad ()

OnEarth
  • 57
  • 1
  • 6
  • 2
    it is not clear what you are trying to do, can you show data, expected format? – Hi computer Jul 19 '22 at 03:10
  • I just want to add zero to the end of the time series. But in a smooth way that doesn't make discontinuity in the frequency domain. – OnEarth Jul 19 '22 at 04:10
  • There's no "smooth way" to pad with zeros: you just add a bunch of zeros at the end of the series. If you want a padding function, one that smoothly converges to zero, then your problem is analytical and not about programming. Once you know the function you want, ask again if you don't know how to implement it. – Ignatius Reilly Jul 22 '22 at 17:45

1 Answers1

0

I assume you are trying to "fill" a float with zeros, right?

For example, instead of receiving 6.9, do you want 6.900000?

If this is your case, you can format, it like code below. But keep in mind that Python is converting your float to a string...

format(6.9, '.6f')
#'6.900000'