3

I have a time series data

I am trying to find the fft .But it gives keyerror :Aligned when trying to get the value

my data looks like below

The data looks like this

this is the code:

import datetime
import numpy as np
import scipy as sp
import scipy.fftpack
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

temp_fft = sp.fftpack.fft(data3)


Priya
  • 33
  • 1
  • 4

1 Answers1

8

Looks like your data is a pandas series. fft works with numpy arrays rather than series.
Easy resolution is to convert your series into a numpy array either via

data3.values 

or

np.array(data3)

You can then pass that array into fft function. So the end result is:

temp_fft = sp.fftpack.fft(data3.values)

This should work for you now.

Sherry
  • 353
  • 3
  • 15