Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205491

Replace a value on one data set with a value from another data set with a dynamic lookup

$
0
0

This question relates primarly to Alteryx, however if it can be done in Python, or R in Alteryx workflow using the R tool then that would work as well.

I have two data sets.

Address (contains address information: Line1, Line2, City, State, Zip)

USPS (contains USPS abbreviations: Street to ST, Boulevard to BLVD, etc.)

Goal: Look at the string on the Address data set for Line1. IF it CONTAINS one of the types of streets in the USPS data set, I want to replace that part of the string with its proper abbreviation which is in a different column of the USPS data set.

Example, 123 Main Street would become 123 Main St

What I have tried: Imported the two data sets. Union the two data sets with the instruction of Output All Fields for When Fields Differ. Added a formula, but this is where I am getting stuck. So far it reads:

if [Addr1] Contains(Sting, Target)

Not sure how to have it look in the USPS for one of the values. I am also not certain if this sort of dynamic lookup can take place.

If this can be done in python (I know very basic Python so I don't have code for this yet because I do not know where to start other than importing the data) I can use python within Alteryx.

Any assistance would be great. Please let me know if you need additional information.

Thank you in advance.


Viewing all articles
Browse latest Browse all 205491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>