File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 12
12
from pandas .core .algorithms import quantile
13
13
from pandas .tools .tile import cut , qcut
14
14
import pandas .tools .tile as tmod
15
+ from pandas import to_datetime
15
16
16
17
17
18
class TestCut (tm .TestCase ):
@@ -283,6 +284,16 @@ def test_single_bin(self):
283
284
result = cut (s , 1 , labels = False )
284
285
tm .assert_series_equal (result , expected )
285
286
287
+ def test_datetime_cut (self ):
288
+ data = to_datetime (Series (['2013-01-01' , '2013-01-02' , '2013-01-03' ]))
289
+ result = cut (data , 3 )
290
+ self .assertEqual (result [0 ],
291
+ '(2012-12-31 23:57:07.200000, 2013-01-01 16:00:00]' )
292
+ self .assertEqual (result [1 ],
293
+ '(2013-01-01 16:00:00, 2013-01-02 08:00:00]' )
294
+ self .assertEqual (result [2 ],
295
+ '(2013-01-02 08:00:00, 2013-01-03 00:00:00]' )
296
+
286
297
287
298
def curpath ():
288
299
pth , _ = os .path .split (os .path .abspath (__file__ ))
You can’t perform that action at this time.
0 commit comments