Replace Function

Replacing text in a whole column is a powerful tool. For instance, when combining tables that two people in your organization worked on, the column's values may have been named differently. One person might have put "New York", the other "NY". They mean the same thing, but analysis fails in these cases. Another example is when you internally decide to rename a value, such as deciding that "male" should be replaced with "identifies as male". There are many other use cases in which you may want to rename the values of your columns. Here is how you do it:

Note: In order to use the Model feature you already should have already imported data sources into the Y42.


Adding the Replace Node to Your Model

  1. In the Model tab, click Add... Name your new data transformation and choose a privacy level.
  2. Create at least one input table by dragging and dropping the Input field into your data model structure. Choose a data table by clicking on it, then click Apply.
  3. Drag and drop a Replace node close to the Input field.

    In_to_Rep.png

Setting Up Your Replace Node

  1. Click on the Replace Node to apply the node settings.

    Rep_Node.png

  2. You can choose to create a new column by typing it into the Column name box or overwrite an existing column by selecting it from the menu.
  3. Then, select the Target Column. This is the column you want to apply the text replacement on.
  4. Select the text you want to select by typing it into the Replace box. You can choose whether you want to be Case Sensitive or not: Do you only want to replace "male" or also "Male"? You can also choose if you require a Full Match in the cell or if the selected text just has to be part of the cell.
  5. Finally, type in the text you want to Replace With.
  6. You can add other replace cases in the same column by clicking Add Replace Case. If you want to apply the replace function on other columns, click the green +.
  7. When you're done, click Save.

Once you're done replacing text in your columns, you can either perform further transformations or, if you want to export the new data table, click Commit Model.

Was this article helpful?
0 out of 0 found this helpful