Skip to content

DOC: Include_lowest parameter docs modification #55577

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 5 commits into from
Closed
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
20 changes: 19 additions & 1 deletion pandas/core/reshape/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def cut(
precision : int, default 3
The precision at which to store and display the bins labels.
include_lowest : bool, default False
Whether the first interval should be left-inclusive or not.
Whether the first interval should be left-inclusive or not.
duplicates : {default 'raise', 'drop'}, optional
If bin edges are not unique, raise ValueError or drop non-uniques.
ordered : bool, default True
Expand All @@ -111,6 +111,24 @@ def cut(
the resulting categorical will be ordered. If False, the resulting
categorical will be unordered (labels must be provided).

Notes
-------
Using include_lowest shifts the lower bound of x by -0.001,
due to the .1% extension on the range x, which makes the
dtype of bin intervals to change from int64 to float64

Examples
--------
In:
>>> pd.cut(np.array([0, 1, 7]), bins=[0, 3, 6, 8], include_lowest=True)
... # doctest: +ELLIPSIS
Out:
[(-0.001, 3.0], (-0.001, 3.0], (6.0, 8.0]]
Categories (3, interval[float64]): [(-0.001, 3.0] < (3.0, 6.0] < (6.0, 8.0]]

The lowermost interval changes from 0 to -0.001 after .1% adjustment
which results in change of dtype from int64 to float64

Returns
-------
out : Categorical, Series, or ndarray
Expand Down