Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add rows() method.

  • Loading branch information...
commit 4b2d5799a9f3af93b8327758c06f5c6890bc5a1a 1 parent 31deb0c
@eseraygun authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 table.py
View
11 table.py
@@ -62,6 +62,17 @@ def column(self, columnName):
"""
return self.matrix[:, self.columnIndices[columnName]]
+ def rows(self):
+ """
+ Returns a list of dicts.
+ """
+ rows = []
+ for rowName in self.rowNames:
+ row = {columnName: self[rowName, columnName] for columnName in self.columnNames}
+ row["_"] = rowName
+ rows.append(row)
+ return rows
+
def __getRowIndex(self, rowName):
if rowName is None:
return None
Please sign in to comment.
Something went wrong with that request. Please try again.