我想将数据帧转换为 fasttext 格式
我的数据框
text label
Fan bake vs bake baking
What's the purpose of a bread box? storage-method
Michelin Three Star Restaurant; but if the chef is not there restaurant
快速文本格式
__label__baking Fan bake vs bake
__label__storage-method What's the purpose of a bread box?
__label__restaurant Michelin Three Star Restaurant; but if the chef is not there
我尝试了 df['label'].apply(lambda x: '__label__' + x).add_suffix(df['text'])
但它没有像我预期的那样工作。我应该如何更改我的代码?
最佳答案
尝试:
'__label__'+df['label']+' '+df['text']
关于python - 将数据帧转换为快速文本数据格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65102525/