Unable To Create Dataframe From Output Obtained
I am implementing an emotion analysis using lstm method, I have already trained my model and I am doing my prediction part where I have already done the prediction correctly. Now i
Solution 1:
The problem is with this line:
dataframe={'name': [name],'date': [date], 'comment': [comment], 'label':[label_probs]}
Make empty lists for name, date, comment, label_probs and append them to that list and pass that list to your DataFrame
selection1 = new_data['selection1']
names = []
dates = []
comments = []
labels = []
with open('output1.json', 'w') as f:
json.dump(new_data, f)
selection1 = new_data['selection1']
for item in selection1:
name = item['name']
names.append(name) #<-----------------
.
.
.
Date = item['reviews']
for d in Date:
date = d['date']
dates.append(date) #<--------------
print('>>>>>>>>>>>>>>>>>> ', date)
.
.
.
.
Then
dataframe={'name': names,'date': dates,........}
Updated answer:
for item in selection1:
name = item['name']
Date = item['reviews']
for d in Date:
names.append(name) #<-----------------
date = d['date']
dates.append(date) #<--------------
.
.
.
This should solve your problem.
Post a Comment for "Unable To Create Dataframe From Output Obtained"