Here is my approach: I need to populate a dataframe from data for sentiment analysis.
for file_ in sorted(os.listdir(path)):
with open(os.path.join(path, file_), 'r', encoding='utf-8') as infile:
txt = infile.read()
list_data.append([txt, labels[l]])
phar.update()
df = pd.DataFrame(list_data)
df.columns = ['review', 'sentiment']