vendredi 27 mars 2015

Transpose Data from columns to rows

I am planning to work on "High-Utility Item set mining" via java based SPMF tool. But the issue is getting the data into right format before load the data into SPMF.


My current format:



Transaction # Item Amount

1001 200 14
1001 201 13
1001 202 16
1001 205 17
1002 300 11
1002 305 12
1002 200 30


Desired output: (No transaction number needed, each transaction is one line)



200 201 202 205:60:14 13 16 17
300 305 200:53:11 12 30


Explanation for desired output:



200 201 202 205 ---> are Items (left of 1st row)
14 13 16 17 ---> are Amount (right of first row)
:60: ----> is total amount of transaction # 1001 (14+13+16+17)


I am open to any solution. I can load my current format into SQL and extract the data via SQL query if I get right query to achieve my output. Please help.


Aucun commentaire:

Enregistrer un commentaire