Split rows by null value - Talend Data Integration - talend

I need to split a column of a file into multiple outputs.
I am working with talent data integration.
Thanks!
I need to split the row into multiples outputs, the row must be divided up to the null value.
1 Output
2 Output

Related

Tableau How to evenly split a Ranking Table into two

I am trying to evenly split a ranking table into two.
I tried to create a calculated field using rank to divide the data into two groups.
The problem with this approach is that there are too many entries in the first column because they are tie with rank 1.
I don't want to break the tie but display evenly in both columns.
So, desired output will look like...
25 states with Rank 1 are displayed in column 1, and the rest 12 rank 1 states and the other states from rank 38 to 49 are displayed in column 2.
In order to split your rows within a specif number (say 25) you can't rely just on rank due to same values for multiple rows.
Even though your Rank calculated field must be shown in the chart, you can add another calculated field based on rank_unique which will provide you a progressive number for rows having the same value for the specified metric.
Just use the specified function:
RANK_UNIQUE(SUM([Value]),'desc')
And then use the calculated field as a filter to "split" the results as you need (in this example 1-4, 5-8).

Turn 1 row into multiple rows in Azure Data Flows

I have a dataset along the lines of:
Account No
P01_Ind
P02_Ind
P03_Ind
1
Y
Y
N
2
Y
N
Y
3
N
Y
N
Is there a way of adding a transformation in Azure Data Flows so that each row would turn into 1 or more rows depending on these indicator columns? In this example, my dataset would become:
Account No
Indicator
1
P01
1
P02
2
P01
2
P03
3
P02
I looked at Unpivot but I couldn't see how this would work with this data. Note that this transformed dataset would undergo further transforms and wouldn't be sinked after this step. Any tips gratefully received. Thanks.
You can use ConditionalSplit transformation then add Indicator column to each condition by 'DerivedColumn' transformation. Finally, use Union and Select transformation to meet your need.(You can sort output of Select transformation if you need.)
Steps:
create a dataset and its data like your provided.
use ConditionalSplit transformation to split data to different stream.
add Indicator column to each stream.
union three stream
use 'Select' transformation to delete P01_Ind,P02_Ind,P03_Ind column.
sort output of Select transformation.
Data preview of 'Sort':
This is as simple as doing a unpivot which will get you the rows with 'Y'/'N' as another column and then filtering the rest out for values of 'N'.
You will get
1 P01_Ind Y
2 P02_Ind Y
3 P03_Ind N
.....
It is scalable next time you have 10 instead of 3 columns.

How to get a collective output of multiple loop run using a selection condition in Matlab?

I have a table (L-arrival) of 279 rows and 252 columns. Only the first column has values while others are just NaN. The cells in the first column have multiple values (i.e. some have 1, some have 4 number of values). First of all, I am trying to select a single maximum value from each cell of the first column so that I can have a column of a single value for each cell only. Then I want to do this in a loop so that for every new value that I get, they are sorted and only the maximum values are chosen. Finally, I want to make a collection of these values obtained from multiple runs for each cell. Can anyone suggest to me how it can be approached in MatLab?I tried using the following code but didn't work well.
for b=1:279
m = numel(cell2mat(L_arrival(b,1)));
g(b)=mat2cell([cell2mat(g(b)); cell(L_arrival(b,1))]',[1 2]);
end

MATLAB matrix operation

I am having matrix with approx 3000 rows(changing) and 3 columns.
I have count of both rows and columns.
I am trying to plot the graph:
x=1:3000;
plot(matrix(x,1))
is there any way that I can include all rows in the plot instruction itself so that I can remove 'x=1:3000' ?
Also, I want to divide, 1st column of matrix which have 3000 rows into another matrix of 3 columns each with 1000 rows. Any specific instruction for this ?
I have made for loop for this and then i am placing individually the elements in the new array. But its taking long time.
As to the plotting issue, using the colon operator will plot all rows for your desired column:
plot(matrix(:,1));
EDIT: You mentioned you were a beginner. In case you haven't seen the colon operator used like this before, a colon operator all by itself when indexing into a matrix essentially means "all __", either "all rows" if in the first position or "all columns" if in the second position.
As for the second question, of splitting one column into a new matrix with multiple columns, you can use the reshape() function, which takes the input matrix to be reshaped and a number of output rows and columns. For example, to split the first column of matrix into 3 columns and put them into newMatrix, use the following:
newMatrix = reshape(matrix(:,1),[],3);
Note that the above code uses [] in the second argument (the number of rows argument) to mean "automatically determine number of rows".This is automatically determined based on the number of columns, which is defined in the third argument here as 3. The reshape function requires that the number of output rows * output columns be equal to input rows * input columns. So in the above case this will only work if the starting matrix has a number of rows which is divisible by 3.

Extracting and arranging nested data within cell array

I need to ingest a CDF (common data format) file into MATLAB. I have used the [cdfread][1] command for this purpose. An image of my output is attached below:
When I open data_import, columns 4 and 5 are in a particular 3 x 1 format (as shown in data_import(1,4)).
My question is: Is there a simple way to extract the data for each cell in column 4, such that for the 2nd row in data_import(1,4), it gets inserted as a new column (i.e. column 5) in the original data (data_import)? Similarly, 3rd row in data_import(1,4) should be inserted as a new column (column 6) in the original data (data_import). This procedure should also be repeated in the original Column 5 data which also has a similar 3 x 1 structure within each cell.
I hope I'm not being too vague in what I am describing, but I'm really not sure what I'm supposed to do regarding the commands to call for the operation. Thank you in advance.
Your desired final output has columns which are made up of these cells converted from 3 x 1 arrays to 1 x 3 cell arrays and then concatenated for each row. It's easier to do the concatenation first with the elements the "wrong way round" and then transpose the final result:
data_import = [data_import(:,1:3) num2cell([data_import{:,4}; data_import{:,5}]') data_import(:,6:end)];