Split

Split is to separate a single column into multiple columns based on a given string or character. Suppose you have a date column in a "yyyy-mm-dd" format, and you want to separate year, month and day into different columns. You can use Split and specify "-" as the separator. Then, the action removes "-" and breaks down "2021-04-30" into three parts, "2021", "04", and "30". Each part becomes a new column.

Split can be used for any type of data (such as string, integer, date, etc.). However, no matter what type of data the original column is, the resulting columns turn out to be string columns and appear next to the original column.

There are four elements under the Split action in Acho:

  • Column to split

    Click the dropdown menu to select a column that you want to split. It includes all column names that exist in your table. You can only choose one column at each time.

  • Direction

    Determine where the action starts to extract the values. Directions lead to different orders of the resulting columns and extract different values based on the number of columns that you want to split. There are two options here:

    • First: to select the number of values from the beginning. The below example is to extract the first two substrings.

    • Last: to select the number of values from the end. The below example is to extract the last two substrings.

  • Split by

    Specify a value as a separator. You can type in any values here,, such as an integer, a character, or a word)

  • Number of columns

    Specify how many values you want to extract from the original column. The minimum value is 2.

Special cases

  • There is no value before or after the separator. For example, suppose you want to split the date column into two columns and set the separator as "2021". Since there is no value before "2021", the first column will be null and the rest of the strings are placed in the second column. (To deal with nulls, You can use replace nulls)

  • The number of values that you want to have is more than the number of values that you can split. For example, suppose you want to split the date column into 3 columns, and set the separator as "4". Since there is only one "4" in the string, it can only split the string into two columns, "2021-0" and "-30". Thus, the third column will be null. (To deal with nulls, You can use replace nulls in Cleanse)

  • The string doesn't contain the separator. For example, suppose you want to split the date column into 3 columns and set the separator as "5". Since the system cannot find the "5" in "2021-04-30", it will put the entire string in the first column and make the rest of the columns be nulls.

Last updated