python - 将数据帧转换为 fasttext 数据格式
问题描述
我想将数据框转换为 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']
推荐阅读
- android - 如何以调用另一个活动的方式使 ListView 中的每个项目可点击?
- c# - 获取UTC c#中对应的起始本地小时
- java - Custom GIS Routes
- c# - WPF - 是否可以将 DataGrid 导出为 PDF?
- java - how to print List of Objects inside Object in Thymleaf?
- php - Write query with subquery in CodeIgniter Query Builder?
- java - Splunk doesnt return all the results - using rest API -
- python - 按对象计算分组中子组中的行数
- mongodb - inMemoryDB 的 MongoDb 身份验证?
- javascript - Readonly component in angular doesn't show line breaks