Description
Here is an example of pandas.cut ran on a pandas.Series with only one positive element and then on a pandas.Series with only one negative element. In the second scenario pandas.cut is not able to insert the single value on the only one bin.
I might be wrong but I expected pandas.cut to behave on negative values the same as with positive
values.
A small, complete example of the issue
import pandas as pd
import numpy as np
>>> s = pd.Series([1.])
>>> pd.cut(s, 1)
0 (0.999, 1.001]
dtype: category
Categories (1, object): [(0.999, 1.001]]
>>> s = pd.Series([-1.])
>>> pd.cut(s, 1)
0 NaN
dtype: category
Categories (1, object): [(-0.999, -1.001]]
Expected Output
>>> s = pd.Series([-1.])
>>> pd.cut(s, 1)
0 (-1.001, -0.999]
dtype: category
Categories (1, object): [(-1.001, -0.999]]
Output of pd.show_versions()
pandas: 0.18.1
nose: 1.3.1
pip: 1.5.4
setuptools: 28.0.0
Cython: 0.20.1post0
numpy: 1.11.1
scipy: 0.18.0
statsmodels: 0.6.1
xarray: None
IPython: 5.1.0
sphinx: 1.4.8
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.8
apiclient: None
sqlalchemy: 1.0.14
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: 0.2.1