Python Pandas TypeError: First Argument Must Be String Or Compiled Pattern
I am sorry for the super easy question, but I can't make it work I am cleaning data and want to add a flag, if the name (which is seperate into two columns First and Last Name) is
Solution 1:
IF you are trying to look for both regex patterns- as in search for both ?
and tourist
in the string. you can use the |
operator. So change pattern
to
pattern = "tourist|\?"
This will check if a question mark OR if 'tourist` is in the string
If you ever want to check regex, pythex is a really good place. I made a test one for you.
Post a Comment for "Python Pandas TypeError: First Argument Must Be String Or Compiled Pattern"