array sliding with spark dataframes
up vote
-3
down vote
favorite
suppose the data is T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0
using scala spark dataframe, how to split into the following format
T 32
P 1
A 420
H 60
R 0.30841494477846165
S 0
Any suggestions are greatly appreciated.
Thanks in advance
apache-spark dataframe sliding
add a comment |
up vote
-3
down vote
favorite
suppose the data is T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0
using scala spark dataframe, how to split into the following format
T 32
P 1
A 420
H 60
R 0.30841494477846165
S 0
Any suggestions are greatly appreciated.
Thanks in advance
apache-spark dataframe sliding
You want a row of data with columns T, P, A, H, R, S?
– Terry Dactyl
Nov 8 at 14:17
Is the data ` T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0 ` single row ? or the whole data ?
– Shankar Koirala
Nov 8 at 14:18
Can you add few more inputs and expected results
– Shankar Koirala
Nov 8 at 14:23
another example
– Shakti
Nov 9 at 5:06
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
suppose the data is T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0
using scala spark dataframe, how to split into the following format
T 32
P 1
A 420
H 60
R 0.30841494477846165
S 0
Any suggestions are greatly appreciated.
Thanks in advance
apache-spark dataframe sliding
suppose the data is T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0
using scala spark dataframe, how to split into the following format
T 32
P 1
A 420
H 60
R 0.30841494477846165
S 0
Any suggestions are greatly appreciated.
Thanks in advance
apache-spark dataframe sliding
apache-spark dataframe sliding
asked Nov 8 at 13:41
Shakti
13
13
You want a row of data with columns T, P, A, H, R, S?
– Terry Dactyl
Nov 8 at 14:17
Is the data ` T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0 ` single row ? or the whole data ?
– Shankar Koirala
Nov 8 at 14:18
Can you add few more inputs and expected results
– Shankar Koirala
Nov 8 at 14:23
another example
– Shakti
Nov 9 at 5:06
add a comment |
You want a row of data with columns T, P, A, H, R, S?
– Terry Dactyl
Nov 8 at 14:17
Is the data ` T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0 ` single row ? or the whole data ?
– Shankar Koirala
Nov 8 at 14:18
Can you add few more inputs and expected results
– Shankar Koirala
Nov 8 at 14:23
another example
– Shakti
Nov 9 at 5:06
You want a row of data with columns T, P, A, H, R, S?
– Terry Dactyl
Nov 8 at 14:17
You want a row of data with columns T, P, A, H, R, S?
– Terry Dactyl
Nov 8 at 14:17
Is the data ` T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0 ` single row ? or the whole data ?
– Shankar Koirala
Nov 8 at 14:18
Is the data ` T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0 ` single row ? or the whole data ?
– Shankar Koirala
Nov 8 at 14:18
Can you add few more inputs and expected results
– Shankar Koirala
Nov 8 at 14:23
Can you add few more inputs and expected results
– Shankar Koirala
Nov 8 at 14:23
another example
– Shakti
Nov 9 at 5:06
another example
– Shakti
Nov 9 at 5:06
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
another example
+-------+-------------+-----------------------------------------------------------------------------+
|Pcode |Pname |Pdetails |
+-------+-------------+-----------------------------------------------------------------------------+
|Water12|HimalayaWater|Price,1.20;Qty,250ml;Brand,Himalaya;Class,Liquid |
|Snack23|Mad Pringles |Price,0.65;Qty,165 g;Brand,MadLtd;Class,Snacks;Batch,12312334;Exp,12/Feb/2012|
+-------+-------------+-----------------------------------------------------------------------------+
i want pdeatils to be split into two columns Type and Value, and expected output is
+-------+-------------+-----+-----------+
|Pcode |Pname |Type |Value |
+-------+-------------+-----+-----------+
|Water12|HimalayaWater|Price|1.20 |
|Water12|HimalayaWater|Qty |250ml |
|Water12|HimalayaWater|Brand|Himalaya |
|Water12|HimalayaWater|Class|Liquid |
|Snack23|Mad Pringles |Price|0.65 |
|Snack23|Mad Pringles |Qty |165 g |
|Snack23|Mad Pringles |Brand|MadLtd |
|Snack23|Mad Pringles |Class|Snacks |
|Snack23|Mad Pringles |Batch|12312334 |
|Snack23|Mad Pringles |Exp |12/Feb/2012|
+-------+-------------+-----+-----------+
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
another example
+-------+-------------+-----------------------------------------------------------------------------+
|Pcode |Pname |Pdetails |
+-------+-------------+-----------------------------------------------------------------------------+
|Water12|HimalayaWater|Price,1.20;Qty,250ml;Brand,Himalaya;Class,Liquid |
|Snack23|Mad Pringles |Price,0.65;Qty,165 g;Brand,MadLtd;Class,Snacks;Batch,12312334;Exp,12/Feb/2012|
+-------+-------------+-----------------------------------------------------------------------------+
i want pdeatils to be split into two columns Type and Value, and expected output is
+-------+-------------+-----+-----------+
|Pcode |Pname |Type |Value |
+-------+-------------+-----+-----------+
|Water12|HimalayaWater|Price|1.20 |
|Water12|HimalayaWater|Qty |250ml |
|Water12|HimalayaWater|Brand|Himalaya |
|Water12|HimalayaWater|Class|Liquid |
|Snack23|Mad Pringles |Price|0.65 |
|Snack23|Mad Pringles |Qty |165 g |
|Snack23|Mad Pringles |Brand|MadLtd |
|Snack23|Mad Pringles |Class|Snacks |
|Snack23|Mad Pringles |Batch|12312334 |
|Snack23|Mad Pringles |Exp |12/Feb/2012|
+-------+-------------+-----+-----------+
add a comment |
up vote
0
down vote
another example
+-------+-------------+-----------------------------------------------------------------------------+
|Pcode |Pname |Pdetails |
+-------+-------------+-----------------------------------------------------------------------------+
|Water12|HimalayaWater|Price,1.20;Qty,250ml;Brand,Himalaya;Class,Liquid |
|Snack23|Mad Pringles |Price,0.65;Qty,165 g;Brand,MadLtd;Class,Snacks;Batch,12312334;Exp,12/Feb/2012|
+-------+-------------+-----------------------------------------------------------------------------+
i want pdeatils to be split into two columns Type and Value, and expected output is
+-------+-------------+-----+-----------+
|Pcode |Pname |Type |Value |
+-------+-------------+-----+-----------+
|Water12|HimalayaWater|Price|1.20 |
|Water12|HimalayaWater|Qty |250ml |
|Water12|HimalayaWater|Brand|Himalaya |
|Water12|HimalayaWater|Class|Liquid |
|Snack23|Mad Pringles |Price|0.65 |
|Snack23|Mad Pringles |Qty |165 g |
|Snack23|Mad Pringles |Brand|MadLtd |
|Snack23|Mad Pringles |Class|Snacks |
|Snack23|Mad Pringles |Batch|12312334 |
|Snack23|Mad Pringles |Exp |12/Feb/2012|
+-------+-------------+-----+-----------+
add a comment |
up vote
0
down vote
up vote
0
down vote
another example
+-------+-------------+-----------------------------------------------------------------------------+
|Pcode |Pname |Pdetails |
+-------+-------------+-----------------------------------------------------------------------------+
|Water12|HimalayaWater|Price,1.20;Qty,250ml;Brand,Himalaya;Class,Liquid |
|Snack23|Mad Pringles |Price,0.65;Qty,165 g;Brand,MadLtd;Class,Snacks;Batch,12312334;Exp,12/Feb/2012|
+-------+-------------+-----------------------------------------------------------------------------+
i want pdeatils to be split into two columns Type and Value, and expected output is
+-------+-------------+-----+-----------+
|Pcode |Pname |Type |Value |
+-------+-------------+-----+-----------+
|Water12|HimalayaWater|Price|1.20 |
|Water12|HimalayaWater|Qty |250ml |
|Water12|HimalayaWater|Brand|Himalaya |
|Water12|HimalayaWater|Class|Liquid |
|Snack23|Mad Pringles |Price|0.65 |
|Snack23|Mad Pringles |Qty |165 g |
|Snack23|Mad Pringles |Brand|MadLtd |
|Snack23|Mad Pringles |Class|Snacks |
|Snack23|Mad Pringles |Batch|12312334 |
|Snack23|Mad Pringles |Exp |12/Feb/2012|
+-------+-------------+-----+-----------+
another example
+-------+-------------+-----------------------------------------------------------------------------+
|Pcode |Pname |Pdetails |
+-------+-------------+-----------------------------------------------------------------------------+
|Water12|HimalayaWater|Price,1.20;Qty,250ml;Brand,Himalaya;Class,Liquid |
|Snack23|Mad Pringles |Price,0.65;Qty,165 g;Brand,MadLtd;Class,Snacks;Batch,12312334;Exp,12/Feb/2012|
+-------+-------------+-----------------------------------------------------------------------------+
i want pdeatils to be split into two columns Type and Value, and expected output is
+-------+-------------+-----+-----------+
|Pcode |Pname |Type |Value |
+-------+-------------+-----+-----------+
|Water12|HimalayaWater|Price|1.20 |
|Water12|HimalayaWater|Qty |250ml |
|Water12|HimalayaWater|Brand|Himalaya |
|Water12|HimalayaWater|Class|Liquid |
|Snack23|Mad Pringles |Price|0.65 |
|Snack23|Mad Pringles |Qty |165 g |
|Snack23|Mad Pringles |Brand|MadLtd |
|Snack23|Mad Pringles |Class|Snacks |
|Snack23|Mad Pringles |Batch|12312334 |
|Snack23|Mad Pringles |Exp |12/Feb/2012|
+-------+-------------+-----+-----------+
edited Nov 9 at 5:22
answered Nov 9 at 5:13
Shakti
13
13
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208960%2farray-sliding-with-spark-dataframes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You want a row of data with columns T, P, A, H, R, S?
– Terry Dactyl
Nov 8 at 14:17
Is the data ` T_32_P_1_A_420_H_60_R_0.30841494477846165_S_0 ` single row ? or the whole data ?
– Shankar Koirala
Nov 8 at 14:18
Can you add few more inputs and expected results
– Shankar Koirala
Nov 8 at 14:23
another example
– Shakti
Nov 9 at 5:06