From a774789252d41522d4ec8b0e2c212aff4a33904d Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 7 Feb 2016 06:40:46 -0500 Subject: /s/unique/remove_duplicates #182 --- tablib/core.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tablib/core.py') 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 -- cgit v1.2.1