Description
Code Sample
>>> import pandas as pd
>>>
>>> # Toy data
>>> series = pd.Series([0, 1, 5, 6, 10, None, np.nan])
>>> bins = [0, 5, 8]
>>>
>>> pd.cut(series, bins=bins, include_lowest=True)
Out[23]:
0 (-0.001, 5.0]
1 (-0.001, 5.0]
2 (-0.001, 5.0]
3 (5.0, 8.0]
4 NaN
5 NaN
6 NaN
dtype: category
Categories (2, interval[float64]): [(-0.001, 5.0] < (5.0, 8.0]]
Problem description
It was expected that the lower boundary would be [0, 5] (for the first three instances). However, a value of -0.001 was "invented" (?). It worked in version 0.19.2 (with the output shown in Expected Output). Is there any bug? Is there anything I have to specify to make it work again as before?
Expected Output
0 [0, 5.0]
1 [0, 5.0]
2 [0, 5.0]
3 (5.0, 8.0]
4 NaN
5 NaN
6 NaN
dtype: category
Categories (2, interval[float64]): [ [0, 5.0] < (5.0, 8.0]]
Output of pd.show_versions()
pandas: 0.20.3
pytest: None
pip: 9.0.1
setuptools: 36.2.0
Cython: None
numpy: 1.13.1
scipy: 0.19.1
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.0
openpyxl: 2.4.1
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.8
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None