-1

Is there any solution in python to transpose EXCEL multiple rows into one column and store it in the new Excel file,without DataFrame?

 COL1    COL2   COL3
  A       B      C
  D       E      F
  G       H      I

TRANSPOSE

COL1  A
COL1  D
COL1  G
COL2  B
COL2  E
COL2  H
.....
paul
  • 519
  • 6
  • 13

1 Answers1

1

What if you made a two dimensional array of the data? Something like:

exceldata =  [[col1,col2,col3],[A,B,C],[D,E,F],[G,H,I]]
transposed_data = zip(*theArray)

Then loop through every array in the 2d array and input that into the excel sheet as a row

See also: Matrix Transpose in Python

sundance
  • 2,905
  • 4
  • 21
  • 31
  • For obtaining the excel data into a 2d array: loop through each column while the cell value != '' and do the same for each row to obtain how many rows and columns the excel sheet has. – forrestaustin Dec 18 '18 at 15:52