@@ -235,7 +235,7 @@ def cut(x, bins, right=True, labels=None, retbins=False, precision=3,
235
235
duplicates = duplicates )
236
236
237
237
return _postprocess_for_cut (fac , bins , retbins , x_is_series ,
238
- series_index , name )
238
+ series_index , name , dtype )
239
239
240
240
241
241
def qcut (x , q , labels = None , retbins = False , precision = 3 , duplicates = 'raise' ):
@@ -307,7 +307,7 @@ def qcut(x, q, labels=None, retbins=False, precision=3, duplicates='raise'):
307
307
dtype = dtype , duplicates = duplicates )
308
308
309
309
return _postprocess_for_cut (fac , bins , retbins , x_is_series ,
310
- series_index , name )
310
+ series_index , name , dtype )
311
311
312
312
313
313
def _bins_to_cuts (x , bins , right = True , labels = None ,
@@ -365,8 +365,6 @@ def _bins_to_cuts(x, bins, right=True, labels=None,
365
365
result = result .astype (np .float64 )
366
366
np .putmask (result , na_mask , np .nan )
367
367
368
- bins = _convert_bin_to_datelike_type (bins , dtype )
369
-
370
368
return result , bins
371
369
372
370
@@ -511,7 +509,7 @@ def _preprocess_for_cut(x):
511
509
512
510
513
511
def _postprocess_for_cut (fac , bins , retbins , x_is_series ,
514
- series_index , name ):
512
+ series_index , name , dtype ):
515
513
"""
516
514
handles post processing for the cut method where
517
515
we combine the index information if the originally passed
@@ -523,6 +521,8 @@ def _postprocess_for_cut(fac, bins, retbins, x_is_series,
523
521
if not retbins :
524
522
return fac
525
523
524
+ bins = _convert_bin_to_datelike_type (bins , dtype )
525
+
526
526
return fac , bins
527
527
528
528
0 commit comments