Home > OS >  Using contains function in Azure Data Factory Dataflow expression builder
Using contains function in Azure Data Factory Dataflow expression builder

Time:11-10

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

CodePudding user response:

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

CodePudding user response:

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

  • Related