EMD模态分解

pyhht安装,直接pip install pyhht即可

# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from pyhht.emd import EMD
from pyhht.visualization import plot_imfs
from sql_bind_data import sum_id_value,filter_out
values1=sum_id_value(2)
values1=filter_out(values1)
values1.fillna(0,inplace=True)#将数据中的nan替换,EMD不支持处理nan
data=values1
decomposer = EMD(data[0])

imfs = decomposer.decompose()
#绘制分解图
plot_imfs(data[0],imfs,data.index)
#保存IMFs
arr = np.vstack((imfs,data[0]))
dataframe = pd.DataFrame(arr.T)
dataframe.to_csv('D:/GitHub/模态分解成分.csv',index=None,columns=None)

EMD模态分解_第1张图片

你可能感兴趣的:(时序预测)