你可以使用
pivot:
df1 = df.pivot(index='searchTerm', columns='feature', values='score').reset_index()
print (df1)
feature searchTerm a b c
0 chinese 0.566261 0.572405 0.489369
1 pizza 0.534509 0.586020 0.588972
2 thai 0.499068 0.431068 0.441617
最后你可以删除rename_axis列名(pandas 0.18.0中的新内容):
df1 = df1.rename_axis(None, axis=1)
#pandas bellow 0.18.0
#df.columns.name = None
print (df1)
searchTerm a b c
0 chinese 0.566261 0.572405 0.489369
1 pizza 0.534509 0.586020 0.588972
2 thai 0.499068 0.431068 0.441617