Skip to content

Commit

Permalink
ENH: rename col_or_columns argument in DataFrame.drop_duplicates #734
Browse files Browse the repository at this point in the history
  • Loading branch information
wesm committed Feb 5, 2012
1 parent 3583373 commit fe0d5f7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2042,14 +2042,14 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None):
new_labels = labels[mask]
return self.reindex(**{axis_name : new_labels})

def drop_duplicates(self, col_or_columns=None, take_last=False):
def drop_duplicates(self, cols=None, take_last=False):
"""
Return DataFrame with duplicate rows removed, optionally only
considering certain columns
Parameters
----------
col_or_columns : column label or sequence of labels, optional
cols : column label or sequence of labels, optional
Only consider certain columns for identifying duplicates, by
default use all of the columns
take_last : boolean, default False
Expand All @@ -2059,17 +2059,17 @@ def drop_duplicates(self, col_or_columns=None, take_last=False):
-------
deduplicated : DataFrame
"""
duplicated = self.duplicated(col_or_columns, take_last=take_last)
duplicated = self.duplicated(cols, take_last=take_last)
return self[-duplicated]

def duplicated(self, col_or_columns=None, take_last=False):
def duplicated(self, cols=None, take_last=False):
"""
Return boolean Series denoting duplicate rows, optionally only
considering certain columns
Parameters
----------
col_or_columns : column label or sequence of labels, optional
cols : column label or sequence of labels, optional
Only consider certain columns for identifying duplicates, by
default use all of the columns
take_last : boolean, default False
Expand All @@ -2079,11 +2079,11 @@ def duplicated(self, col_or_columns=None, take_last=False):
-------
duplicated : Series
"""
if col_or_columns is not None:
if isinstance(col_or_columns, list):
keys = zip(*[self[x] for x in col_or_columns])
if cols is not None:
if isinstance(cols, list):
keys = zip(*[self[x] for x in cols])
else:
keys = list(self[col_or_columns])
keys = list(self[cols])
else:
keys = zip(*self.values.T)

Expand Down

0 comments on commit fe0d5f7

Please sign in to comment.