I have 2 dimensional list/matrix which is dynamic with N rows and M columns.
The data type within a particular column is uniform, example: col1 is text, col2 is integer, column3 is float etc. The order of the columns can be different. Values for certain rows can be also missing.
Expected result should be 2 lists/arrays/dataframes, where:
list1should be duplicatedNtimes (depending the number of rows)col1_r1, col1_r2, ....., colM_row_n, with appended iterator or the number of rowslist2should be transposed values of the rows (including the empty ones)
What is the best way to achieve this in Python 3.6 using native lists or/and numpy arrays or/and panda dataframes?
output_list1 = [col1_1, col1_2, col1_3, col1_4, col1_5, col2_1, col2_2,
col2_3, col2_4, col2_5, col3_1, col3_2, col3_3, col3_4, col3_5]
-
output_list2 = ["value-row1,col1", "", "value-row3,col1", "value-row4,col1",
",value-row5,col1", "value-row1,col2", "value-row2,col2", "value-row3,col3",
0, "value-row5, col5", "value-row1, col3", 0.0, 0.0, 0.0, "value-row5,col4"]
Thanks in advance for your help.
