Commit 962d604e authored by 张彦钊's avatar 张彦钊

修复生成tfrecord文件时的bug

parent fac49e8b
......@@ -110,7 +110,10 @@ def app_list_func(x,l):
b = x.split(",")
e = []
for i in b:
e.append(l[i])
if i in l.keys:
e.append(l[i])
else:
e.append(0)
return ",".join([str(j) for j in e])
......
......@@ -33,8 +33,8 @@ def gen_tfrecords(in_file):
id = np.array([])
for j in feats:
id = np.append(id,df[j][i])
app_list = np.array(df["app_list"][i].split(","))
level2_list = np.array(df["clevel2_id"][i].split(","))
app_list = np.array(str(df["app_list"][i]).split(","))
level2_list = np.array(str(df["clevel2_id"][i]).split(","))
features = tf.train.Features(feature={
"y": tf.train.Feature(float_list=tf.train.FloatList(value=[df["y"][i]])),
"z": tf.train.Feature(float_list=tf.train.FloatList(value=[df["z"][i]])),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment