Reputation: 1694
I want to convert a dataframe to fasttext format
my dataframe
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
fast text format
__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
I tried df['label'].apply(lambda x: '__label__' + x).add_suffix(df['text'])
But it doesn't work as I expected. How should I change my code ?
Upvotes: 3
Views: 1260