summaryrefslogtreecommitdiff
path: root/tablib/core.py
diff options
context:
space:
mode:
authorMark Walling <mark@markwalling.org>2011-07-11 17:13:47 -0400
committerMark Walling <mark@markwalling.org>2011-07-11 17:26:21 -0400
commite74a8f41cc0bdfe1cb9aae90b9240fd15208e9cb (patch)
tree01cc0408ffea156442f723de66ead76ba9dba5e5 /tablib/core.py
parentcd5aa4fc06d9af90b076c02a9f596bb84db1d09f (diff)
downloadtablib-e74a8f41cc0bdfe1cb9aae90b9240fd15208e9cb.tar.gz
Created get_col method with tests and tutorial.rst update
Useful when you have multiple columns with the same header
Diffstat (limited to 'tablib/core.py')
-rw-r--r--tablib/core.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tablib/core.py b/tablib/core.py
index 7e78b56..0429136 100644
--- a/tablib/core.py
+++ b/tablib/core.py
@@ -175,7 +175,6 @@ class Dataset(object):
else:
return [result.tuple for result in _results]
-
def __setitem__(self, key, value):
self._validate(value)
self._data[key] = Row(value)
@@ -695,6 +694,12 @@ class Dataset(object):
self.rpush_col(col, header)
+ def get_col(self, index):
+ """Returns the column from the :class:`Dataset` at the given index."""
+
+ return [row[index] for row in self._data]
+
+
# ----
# Misc
# ----