I am trying to get a dataframe in the format below into a txt file as shown in the screenshot.
I get relatively close with the code shown but get the following error when I tried to read the txt into my ML algorithm: "labels = set([label.value for sent in self.train for label in sent.labels]) AttributeError: 'NoneType' object has no attribute 'labels'"
Can anyone help?
output['label']=['__label__'+ s for s in output['label'].astype(str)]
output['text']= output['text'].replace('\n',' ', regex=True).replace('\t',' ', regex=True)
output.to_csv(r'sst_train.csv', index=False, sep=' ', header=False)