Calling pandas.cut with timedelta series and incompatible bins should raise TypeError #20605
Labels
Algos
Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff
Duplicate Report
Duplicate issue or pull request
Timedelta
Timedelta data type
Code Sample
Problem description
Calling
pandas.cut
with atimedelta64
series and integer bins returns an all-NaN series. This is inconsistent with two other results:TypeError
as expected.s < 0
) raisesTypeError
as expected.Expected Output
Calling
pandas.cut(s, bins=[0, 2, 5])
with the seriess
described above should raise aTypeError
, because the bin edges are not of type that is comparable with the series values.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.4.5.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 79 Stepping 1, GenuineIntel
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.19.1
nose: 1.3.7
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.2
scipy: 0.18.1
statsmodels: 0.6.1
xarray: 0.8.2
IPython: 5.1.0
sphinx: 1.4.8
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2016.7
blosc: 1.5.0
bottleneck: 1.2.0
tables: 3.2.2
numexpr: 2.6.1
matplotlib: 2.0.0
openpyxl: 2.4.0
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.3
lxml: 3.6.4
bs4: 4.5.3
html5lib: 0.999
httplib2: 0.9.2
apiclient: None
sqlalchemy: 1.1.3
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: 2.43.0
pandas_datareader: None
The text was updated successfully, but these errors were encountered: