我正在尝试分析星星的数据。我有星星的光时间序列,我想预测它们属于哪一类(在 4 种不同类型中)。 我有这些恒星的光时间序列,我想通过去季节化、频率分析和其他可能相关的研究来分析这些时间序列。
对象 time_series 是一个 Pandas DataFrame,包括 10 列:time_points_b、light_points_b(b 代表蓝色)等...
我首先要研究蓝光时间序列。
import statsmodels.api as sm;
import pandas as pd
import matplotlib.pyplot as plt
pd.options.display.mpl_style = 'default'
%matplotlib inline
def star_key(slab_id, star_id_b):
return str(slab_id) + '_' + str(star_id_b)
raw_time_series = pd.read_csv("data/public/train_varlength_features.csv.gz", index_col=0, compression='gzip')
time_series = raw_time_series.applymap(csv_array_to_float)
time_points = np.array(time_series.loc[star_key(patch_id, star_id_b)]['time_points_b'])
light_points = np.array(time_series.loc[star_key(patch_id, star_id_b)]['light_points_b'])
error_points = np.array(time_series.loc[star_key(patch_id, star_id_b)]['error_points_b'])
light_data = pd.DataFrame({'time':time_points[:], 'light':light_points[:]})
residuals = sm.tsa.seasonal_decompose(light_data);
light_plt = residuals.plot()
light_plt.set_size_inches(10, 5)
light_plt.tight_layout()
当我应用 seasonal_decompose 方法时,这段代码给我一个属性错误: AttributeError: 'Int64Index' 对象没有属性 'inferred_freq'
最佳答案
关于python - 在 Python 中分析时间序列 - pandas 格式错误 - statsmodels,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34342370/