提取特征时tsfresh类型错误(Python)
tsfresh type error when extracting features (Python)
当使用 tsfresh 提取相关特征时,我遇到了一个与类型有关的错误,但是我不知道为什么,因为数据是作为 tsfresh 要求的 DataFrame 构建的。任何有关此事的帮助都将非常有用,谢谢!
提取特征的代码:
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
尝试将 y 向量转换为索引与 x 向量匹配的序列
y = pd.Series(gathered_data['flux'], index=gathered_data.ids)
当使用 tsfresh 提取相关特征时,我遇到了一个与类型有关的错误,但是我不知道为什么,因为数据是作为 tsfresh 要求的 DataFrame 构建的。任何有关此事的帮助都将非常有用,谢谢!
提取特征的代码:
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
尝试将 y 向量转换为索引与 x 向量匹配的序列
y = pd.Series(gathered_data['flux'], index=gathered_data.ids)