@@ -767,10 +767,18 @@ def test_sparse_frame_fillna_limit(self):
767
767
tm .assert_frame_equal (result , expected )
768
768
769
769
def test_rename (self ):
770
- # just check this works
771
- rename = self .frame .rename (index = str ) # noqa
772
- rename = self .frame .rename (
773
- columns = lambda x : '%s%d' % (x , len (x ))) # noqa
770
+ result = self .frame .rename (index = str )
771
+ expected = SparseDataFrame (self .data , index = self .dates .strftime (
772
+ "%Y-%m-%d %H:%M:%S" ))
773
+ tm .assert_sp_frame_equal (result , expected )
774
+
775
+ result = self .frame .rename (columns = lambda x : '%s%d' % (x , len (x )))
776
+ data = {'A1' : [nan , nan , nan , 0 , 1 , 2 , 3 , 4 , 5 , 6 ],
777
+ 'B1' : [0 , 1 , 2 , nan , nan , nan , 3 , 4 , 5 , 6 ],
778
+ 'C1' : np .arange (10 , dtype = np .float64 ),
779
+ 'D1' : [0 , 1 , 2 , 3 , 4 , 5 , nan , nan , nan , nan ]}
780
+ expected = SparseDataFrame (data , index = self .dates )
781
+ tm .assert_sp_frame_equal (result , expected )
774
782
775
783
def test_corr (self ):
776
784
res = self .frame .corr ()
@@ -1309,4 +1317,3 @@ def test_numpy_func_call(self):
1309
1317
'std' , 'min' , 'max' ]
1310
1318
for func in funcs :
1311
1319
getattr (np , func )(self .frame )
1312
-
0 commit comments