Dec-20-2021, 05:39 PM
(This post was last modified: Dec-20-2021, 07:11 PM by Gribouillis.)
Below is the code - I am trying to add new column as name - keywords and data frame name is qd1 and column name is CRTXT
The error I am getting is
The error I am getting is
Error:: 'float' object has no attribute 'upper'()
def keyword(row): strings = row['CRTXT'] keywords = ["stopped working","quit working","didnt like","stop working","not working"] keyword = [key for key in keywords if key.upper() in strings.upper()] return ','.join(keyword) df1 = pd.DataFrame(qd1,columns = ['CRTXT']) df1['keyword'] = df1.apply(keyword, axis=1)
Gribouillis write Dec-20-2021, 07:11 PM:
lease post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
lease post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.