This is my final line of code , I need to create a python dataframe from the below line of code. This code is outputting the following see screenshot , How will I create a pandas dataframe from the below code ?
from pprint import pprint
query="Pepper"
results=search(query, top_k=2, index=index, model=model)
cutoff_list = []
number_list = []
print("\n")
for result in results:
#print('\t',result)
cutoff_list.append(result)
cutoff_list
I need the following output enter image description here
Please help
CodePudding user response:
data = []
for item in cutoff_list:
tmp = {}
for item2 in item:
tmp.update(item2)
data.append(tmp)
df = pd.DataFrame(data)
print(df)