Skip to content

Commit

Permalink
fixing duplicates check
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishsingal1 committed Dec 28, 2016
1 parent bee981c commit a2dd8ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pandas/tools/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,12 @@ def _bins_to_cuts(x, bins, right=True, labels=None,
raise ValueError("invalid value for 'duplicates' parameter, "
+ "valid options are: raise, drop")

if duplicates == 'raise':
if len(algos.unique(bins)) < len(bins):
if duplicates == 'raise':
raise ValueError('Bin edges must be unique: %s' % repr(bins) +
' You can drop duplicate edges ' +
'by setting \'duplicates\' param')
else:
else:
bins = algos.unique(bins)

side = 'left' if right else 'right'
Expand Down

0 comments on commit a2dd8ce

Please sign in to comment.