File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 1212from pandas .core .algorithms import quantile
1313from pandas .tools .tile import cut , qcut
1414import pandas .tools .tile as tmod
15+ from pandas import to_datetime
1516
1617
1718class TestCut (tm .TestCase ):
@@ -283,6 +284,16 @@ def test_single_bin(self):
283284 result = cut (s , 1 , labels = False )
284285 tm .assert_series_equal (result , expected )
285286
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+
286297
287298def curpath ():
288299 pth , _ = os .path .split (os .path .abspath (__file__ ))
You can’t perform that action at this time.
0 commit comments