Oct-14-2022, 10:24 AM
(This post was last modified: Oct-14-2022, 10:31 AM by Yoriz.
Edit Reason: Added code tags
)
I'm trying to add a column called ofInterest to select UK postcodes that match RG, OX & SA, the column would contain a 1 if the match is found, or 0 if not found.
My code is:
My code is:
import pandas as pd import re dataset["ofInterest"] = dataset["RegAddress.PostCode"].re.search("[SRO][AGX][0-9]")I'm sure I've got this all wrong because I have very little experience of Python (I know REGEX quite well) - can anybody help me?