代码之家  ›  专栏  ›  技术社区  ›  user8188120

提取特征时出现tsfresh类型错误(Python)

  •  0
  • user8188120  · 技术社区  · 9 年前

    当使用tsfresh提取相关特征时,我遇到了一个与类型相关的错误,但是我不知道为什么,因为数据被构造为tsfresh所需要的数据帧。在这件事上有任何帮助都会很好,谢谢!

    import pandas as pd
    from tsfresh import extract_relevant_features as erf
    
    features = erf(gathered_data,"flux", column_id = "ids",column_sort = "phase")
    

    数据帧:

            ids     phase      flux
    0    5675.0  0.000309  0.953494
    1    5675.0  0.004631  0.987416
    2    5675.0  0.005644  0.975253
    3    5675.0  0.006582  0.978103
    4    5675.0  0.007492  0.978654
    5    5675.0  0.008450  0.967306
    6    5675.0  0.009491  0.966675
    7    5675.0  0.014796  0.973056
    8    5675.0  0.015579  0.960849
    9    5675.0  0.016254  0.963274
    10   5675.0  0.017343  0.960005
    11   5675.0  0.018439  0.962337
    12   5675.0  0.019481  0.974755
    13   5675.0  0.024558  0.971611
    14   5675.0  0.025262  0.972203
    15   5675.0  0.026529  0.973336
    16   5675.0  0.027216  0.978327
    17   5675.0  0.028310  0.976190
    18   5675.0  0.033552  0.972871
    19   5675.0  0.034512  0.976207
    20   5675.0  0.035494  0.975664
    21   5675.0  0.037345  0.969312
    22   5675.0  0.038524  0.964423
    23   5675.0  0.043678  0.963922
    24   5675.0  0.044833  0.970770
    25   5675.0  0.045642  0.954368
    26   5675.0  0.046471  0.967965
    27   5675.0  0.047680  0.962106
    28   5675.0  0.053614  0.962091
    29   5675.0  0.055518  0.971543
    

    错误:

    TypeError: The type of target vector y must be one of: pandas.Series, numpy.ndarray
    
    1 回复  |  直到 9 年前
        1
  •  1
  •   nitroz    9 年前

    尝试将y向量转换为索引匹配x向量的序列

    y=pd.Series(collected\u data['flux'],index=collected\u data.ids)