1
- import nose
2
1
import numpy as np
3
2
4
3
import pandas .util .testing as tm
5
- from pandas import (
6
- Index , Series , DataFrame , isnull , date_range , Timestamp , Period ,
7
- DatetimeIndex , Int64Index , to_datetime , bdate_range , Float64Index ,
8
- NaT , timedelta_range , Timedelta , _np_version_under1p8 , concat )
4
+ from pandas import DataFrame , DatetimeIndex
5
+
6
+ from pandas .util .testing import assert_frame_equal , assert_series_equal
9
7
10
- from pandas .util .testing import (
11
- assert_frame_equal , assert_series_equal , assert_almost_equal ,
12
- _skip_if_has_locale , slow )
13
8
14
9
class TestTimeSeriesPartialSlices (tm .TestCase ):
15
10
_multiprocess_can_split_ = True
11
+
16
12
def assert_exact (self , df , ts , value ):
17
13
element = df ['a' ][ts ]
18
14
@@ -23,15 +19,15 @@ def assert_exact(self, df, ts, value):
23
19
# Frame should raise (exact match)
24
20
self .assertRaises (KeyError , df .__getitem__ , ts )
25
21
26
- #TODO: test falling to column selection
22
+ # TODO: test falling to column selection
27
23
28
- def assert_slice (self , df , ts , slice ):
24
+ def assert_slice (self , df , ts , the_slice ):
29
25
# Series should return slice
30
- expected = df ['a' ][slice ]
26
+ expected = df ['a' ][the_slice ]
31
27
assert_series_equal (df ['a' ][ts ], expected )
32
28
33
29
# Frame should return slice as well
34
- expected = df [slice ]
30
+ expected = df [the_slice ]
35
31
assert_frame_equal (df [ts ], expected )
36
32
37
33
def assert_key_error (self , df , ts ):
@@ -71,7 +67,6 @@ def test_partial_slices_day(self):
71
67
'2012-01-01 00:00:01' ]:
72
68
self .assert_key_error (df , ts )
73
69
74
-
75
70
def test_partial_slice_hour (self ):
76
71
df = DataFrame ({'a' : [1 , 2 , 3 ]}, DatetimeIndex (['2011-12-31 23' ,
77
72
'2012-01-01 00' ,
@@ -165,4 +160,4 @@ def test_partial_slice_second(self):
165
160
self .assert_slice (df , ts , slice (1 , None ))
166
161
167
162
# Not possible to create a string that represents timestamp
168
- # that is more exact then 'second'
163
+ # that is more exact then 'second'
0 commit comments