Mercurial > repos > kellrott > matrix_manipulate
changeset 1:d5cb8190921c draft
Uploaded
| author | kellrott |
|---|---|
| date | Fri, 21 Dec 2012 17:54:47 -0500 |
| parents | eeaa112c9ee0 |
| children | 669cf72f8b79 |
| files | matrix_manipulate/matrix_transpose.py |
| diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/matrix_manipulate/matrix_transpose.py Fri Dec 21 16:43:16 2012 -0500 +++ b/matrix_manipulate/matrix_transpose.py Fri Dec 21 17:54:47 2012 -0500 @@ -28,7 +28,7 @@ col_label = None row_label = [] matrix=[] - for line in fin.readlines(): + for line in fin: data = string.split(line.strip(),'\t') if col_label is None: col_label = data @@ -55,12 +55,12 @@ fout.write("\t".join(out) + "\n") #body - for col in range(0, len(col_label)): + for col in range(1, len(col_label)): out = [] if label_print: - out.append(col_label[col+1]) + out.append(col_label[col]) for row in matrix: - out.append(str(row[col])) + out.append(str(row[col-1])) fout.write("\t".join(out) + "\n") fin.close()
