Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #54: Data Prep Address Parsing

ChloeL-H
7 - Meteor

This was a fun one! I initially completed this challenge without using RegEx. However, upon seeing that it was used in many solutions posted here, I learned how to use it and completed the challenge again. 

Here are my two solutions:

Spoiler
Challenge_54_Solution.JPG
Challenge_54_Solution_2.JPG
jarrod
ACE Emeritus
ACE Emeritus

i tad harder than "beginner" level... i went with Python usaddress library and then CASS/regex Tools for the pure Alteryx approach. Even the python method took me throughout yesterday to track down how to manipulate the output.

Spoiler
jarrod_0-1591880773050.png
#################################
from ayx import Alteryx
import usaddress as usadd
import pandas as pd

add = Alteryx.read('#1')
add['parsed'] = add['Address Text'].apply(lambda x:
                   usadd.tag(x))

def par_address(text,variable):
    try:
        return text[0][variable]
    except KeyError as e:
        return None

add['AddressNumber'] = add['parsed'].apply(lambda x:
                                          par_address(x,"AddressNumber"))

add['StreetNamePreDirectional'] = add['parsed'].apply(lambda x:
                                          par_address(x,"StreetNamePreDirectional"))

add['StreetName'] = add['parsed'].apply(lambda x:
                                          par_address(x,"StreetName"))

add['StreetNamePostType'] = add['parsed'].apply(lambda x:
                                          par_address(x,"StreetNamePostType"))

add['OccupancyType'] = add['parsed'].apply(lambda x:
                                          par_address(x,"OccupancyType"))

add['OccupancyIdentifier'] = add['parsed'].apply(lambda x:
                                          par_address(x,"OccupancyIdentifier"))

add['PlaceName'] = add['parsed'].apply(lambda x:
                                          par_address(x,"PlaceName"))

add['StateName'] = add['parsed'].apply(lambda x:
                                          par_address(x,"StateName"))

add['ZipCode'] = add['parsed'].apply(lambda x:
                                          par_address(x,"ZipCode"))
add = add.drop(columns=['parsed'])

Alteryx.write(add,3)

 #SnakingMyWayThruChallenges

CKP
10 - Fireball

My solution

 

Spoiler
challenge_54_mysolution.jpg
cc000072
8 - Asteroid

Here is my solution.

Spoiler
WeeklyChallenge_Ryohei_54.JPG
Skrupczak
7 - Meteor

Here is my solution! In browsing through others', looks similar to CKP's recent one

Spoiler
Challenge 54.PNG

Sylvana
8 - Asteroid

My solution.

abowers004
7 - Meteor

My solution would not work if there were hundreds of records but there were only 8 displayed, so I basically kept adding formulas to get the data to look how it looks in the output goal. I'm still a beginner and even though this challenge says "beginner", I saw the posted solutions and became overwhelmed so I did it my own way. Again, not the most practical way at all, but it gave me some good practice with formulas.

treepruner
9 - Comet

I'm really getting into RegEx. Or maybe I'm becoming a masochist... 

JohanRanschaert
8 - Asteroid
Spoiler
JohanRanschaert_0-1593429211397.png

 

In attach my solution

Ross_Easton
8 - Asteroid

Solved! Getting the cities took me a while

 

Spoiler
54.PNG