[ad_1]
I am trying to create a dynamic pandas dataframe based on the number of records read, where each record would be a column.
My logic has been to apply a cycle where “for i=1 in N”, where N is a read data (string format) to create the columns. This is not quite right for me, I have tried some alternatives but without good results. I only get the last record of the read.
I leave a proposal:
def funct_example(client):
documents = [ v_document ]
poller = client.begin_analyze_entities(documents)
result = poller.result()
docs = [doc for doc in result if not doc.is_error]
i = 1
for idx, doc in enumerate(docs):
for entity in doc.entities:
for i in doc.entities:
d = {'col'+i : [format(entity.text)]}
df = pd.DataFrame(data=d)
display(df)
funct_example(client)
What alternative do you recommend?
Thanks you!
[ad_2]