python 3.x – REGEX: Extracting street names from US addresses
As the title suggests: I’m new to Python/Pandas and I’m currently doing a case study on restaurants in LA, and have to extract street names out of my column of addresses such that I can get the most popular locations the typical adult would venture to.
This is what I’ve tried thus far:
I’ve managed to eliminate the building number at the start of the string and unit number at the end, accepting only letters/alphanumeric values. However I cannot seem to eliminate STE (suite) and its corresponding suite number.
df['street_name'] = df['address'].str.findall('([^\d]+[\w\d ]+[^\d])')
Example: 600 S ALVARADO ST STE 111C
Output: S ALVARADO ST STE 111C
Desired Output: S ALVARADO ST
Read more here: Source link
