Skip to content

SyntaxWarning fix for regex escape sequences #4

@jamjavad

Description

@jamjavad

Hi

I was running your code and noticed some warnings popping up. When I got to this part:

dataset['Title'] = dataset['Name'].str.extract(' ([A-Za-z]+)\.', expand=False)Python keeps showing:SyntaxWarning: invalid escape sequence '\.'I figured out it's because of the backslash in the regex. Adding an r before the string fixes it:dataset['Title'] = dataset['Name'].str.extract(r' ([A-Za-z]+)\.', expand=False)The code still works either way, but this gets rid of the annoying warnings.Just thought you'd want to know! Great project by the way.

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