I have a question about extract meta-feature to make metatable. Metatable is composed to many statistics values.
For example, I have a iris data. It's consist of float type 4 columns and str type 1 column. And I can make metatable using feature-extractor.
And this is my code example, but str type value can't compute. So I want to using if-else.
# get x1, x2 name value
x1 = []
x2 = []
for col1 in df0.columns:
for col2 in df0.columns:
x1.append(col1)
x2.append(col2)
meta0 = pd.DataFrame(columns = ['x1_name', 'x2_name',
'x1_min', 'x2_min',
'x1_max', 'x2_max',
'x1_entropy', 'x2_entropy'
]
# get dataframe length
for idx in range(len(x1)):
meta0.loc[idx] = 0*(len(x1)+1)
meta0.loc[idx]['x1_name'] = x1[idx]
meta0.loc[idx]['x2_name'] = x2[idx]
# for int, float columns value
# if column type is str, add a zero(0) value
x1_min = []
x1_max = []
x1_entropy = []
for i in range (len(meta0['x1_name'])):
if meta0['x1_name'][i] == x1[i]:
x1_min.append(df0[x1[i]].min())
x1_max.append(df0[x1[i]].max())
x1_entropy.append(list_entropy(df0[x1[i]]))
x2_min = []
x2_max = []
x2_entropy = []
for l in range (len(meta0['x2_name'])):
if meta0['x2_name'][i] == x2[i]:
x2_min.append(df0[x2[l]].min())
x2_max.append(df0[x2[l]].max())
x2_entropy.append(list_entropy(df0[x2[i]]))
Please reply for this problem. Thank you.
Aucun commentaire:
Enregistrer un commentaire