Extract entity from dataframe using spacy

前端 未结 2 915
再見小時候
再見小時候 2021-01-28 19:36

I read contents from excel file using pandas::

import pandas as pd
df = pd.read_excel(\"FAM_template_Update 1911274_JS.xlsx\" )
df

While trying

2条回答
  •  情歌与酒
    2021-01-28 20:07

    You need to loop through the individual strings within your dataframe. The NLP parser and entity extraction is expecting a string.

    For example:

    for row in range(len(df)):
        doc = nlp(df.loc[row, "text_column"])
        for enitity in doc.ents:
             print((entity.text))
    

提交回复
热议问题