summaryrefslogtreecommitdiff
path: root/tablib
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.org>2016-02-07 06:40:46 -0500
committerKenneth Reitz <me@kennethreitz.org>2016-02-07 06:40:46 -0500
commita774789252d41522d4ec8b0e2c212aff4a33904d (patch)
tree0288c7c237a00ce4f7f588082e6dcbece2ddd67f /tablib
parent995eabad37c827d34539500630c710ccf510d7c1 (diff)
downloadtablib-a774789252d41522d4ec8b0e2c212aff4a33904d.tar.gz
/s/unique/remove_duplicates
#182
Diffstat (limited to 'tablib')
-rw-r--r--tablib/core.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tablib/core.py b/tablib/core.py
index e15206e..11a2ea0 100644
--- a/tablib/core.py
+++ b/tablib/core.py
@@ -940,7 +940,7 @@ class Dataset(object):
return _dset
- def unique(self):
+ def remove_duplicates(self):
"""Removes all duplicate rows from the :class:`Dataset` object
while maintaining the original order."""
seen = set()
@@ -961,19 +961,19 @@ class Dataset(object):
# Don't return if no data
if not self:
return
-
+
if rows is None:
rows = list(range(self.height))
-
+
if cols is None:
cols = list(self.headers)
-
+
#filter out impossible rows and columns
rows = [row for row in rows if row in range(self.height)]
cols = [header for header in cols if header in self.headers]
_dset = Dataset()
-
+
#filtering rows and columns
_dset.headers = list(cols)
@@ -989,7 +989,7 @@ class Dataset(object):
if row_no in rows:
_dset.append(row=Row(data_row))
-
+
return _dset