skip to Main Content

I am using Azure Data Factory in which a data flow is used, I want to split my file in to two based on a condition. I am attaching an image with 2 lines, the first one is working but I want to use more programatic approach to achieve the same output:

enter image description here

I have a column named indicator inside my dataset, I want to use contains functionality to split the data, basically having 1 file where a string value inside indicator column has substring Weekly or does not.

Similar to what I would use in pandas:

df1 = df[df.indicator.str.contains('Weekly')]
df2 = df[~df.indicator.str.contains('Weekly')]

enter image description here

2

Answers


  1. If you are looking for the existing of a value inside of a string scalar column, use instr().

    https://learn.microsoft.com/en-us/azure/data-factory/data-flow-expressions-usage#instr

    Login or Signup to reply.
  2. You can try the below expression as well in the Conditional split.

    contains() expects an array. So first split the column content to create the array and give this to contains function.

    contains(split(indicator, ' '),#item=='weekly')
    

    This is my sample data.

    enter image description here

    Conditional split:

    enter image description here

    Weekly data in the output:

    enter image description here

    Remaining data:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search