Skip to content

Qcut msg #9879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/tools/tests/test_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_qcut_specify_quantiles(self):
self.assertTrue(factor.equals(expected))

def test_qcut_all_bins_same(self):
assertRaisesRegexp(ValueError, "edges.*unique", qcut, [0,0,0,0,0,0,0,0,0,0], 3)
assertRaisesRegexp(ValueError, ""The quantiles you selected do not result in unique bins. Try selecting fewer quantiles."", qcut, [0,0,0,0,0,0,0,0,0,0], 3)

def test_cut_out_of_bounds(self):
arr = np.random.randn(100)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tools/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _bins_to_cuts(x, bins, right=True, labels=None, retbins=False,
ids = bins.searchsorted(x, side=side)

if len(algos.unique(bins)) < len(bins):
raise ValueError('Bin edges must be unique: %s' % repr(bins))
raise ValueError('The quantiles you selected do not result in unique bins. Try selecting fewer quantiles.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is also called by the pd.cut function, for which this new message is not appropriate.


if include_lowest:
ids[x == bins[0]] = 1
Expand Down