Skip to content

KeyError: 'content' #1

@illucent

Description

@illucent

If this error occurs

Traceback (most recent call last):
...
KeyError: 'content'
...

it is possible to refactor this function (lines 176 to 179)

#Filling the dataset with sender name and message per row
# Go through all rows
for index, row in dictdf.iterrows():
  tempoutputdf = pd.DataFrame({"sender": [dictdf.iloc[index]['sender_name']],
                              "message": [dictdf.iloc[index]['content']]})
  outputdflist.append(tempoutputdf)

with

#Filling the dataset with sender name and message per row
#Go through all rows
for index, row in dictdf.iterrows():
    content = row.get('content', '')
    tempoutputdf = pd.DataFrame({"sender": [row['sender_name']],
                                "message": [content]})
    outputdflist.append(tempoutputdf)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions