17
17
from pandas import Series , DataFrame , DateRange , Panel
18
18
from pandas .core .datetools import BDay
19
19
import pandas .core .datetools as datetools
20
- import pandas .util .testing as testing
20
+ import pandas .util .testing as tm
21
21
22
22
import pandas .sparse .frame as spf
23
23
@@ -560,7 +560,7 @@ def _compare_all(obj):
560
560
series .fill_value = 2
561
561
_compare_all (series )
562
562
563
- def test_valid (self ):
563
+ def test_dropna (self ):
564
564
sp = SparseSeries ([0 , 0 , 0 , nan , nan , 5 , 6 ],
565
565
fill_value = 0 )
566
566
@@ -570,6 +570,11 @@ def test_valid(self):
570
570
self .assert_ (sp_valid .index .equals (sp .to_dense ().valid ().index ))
571
571
self .assertEquals (len (sp_valid .sp_values ), 2 )
572
572
573
+ result = self .bseries .dropna ()
574
+ expected = self .bseries .to_dense ().dropna ()
575
+ self .assert_ (not isinstance (result , SparseSeries ))
576
+ tm .assert_series_equal (result , expected )
577
+
573
578
def test_homogenize (self ):
574
579
def _check_matches (indices , expected ):
575
580
data = {}
@@ -789,7 +794,7 @@ def test_dense_to_sparse(self):
789
794
self .assert_ (isinstance (sdf , SparseDataFrame ))
790
795
self .assert_ (np .isnan (sdf .default_fill_value ))
791
796
self .assert_ (isinstance (sdf ['A' ].sp_index , BlockIndex ))
792
- testing .assert_frame_equal (sdf .to_dense (), df )
797
+ tm .assert_frame_equal (sdf .to_dense (), df )
793
798
794
799
sdf = df .to_sparse (kind = 'integer' )
795
800
self .assert_ (isinstance (sdf ['A' ].sp_index , IntIndex ))
@@ -798,7 +803,7 @@ def test_dense_to_sparse(self):
798
803
'B' : [1 , 2 , 0 , 0 , 0 ]}, dtype = float )
799
804
sdf = df .to_sparse (fill_value = 0 )
800
805
self .assertEquals (sdf .default_fill_value , 0 )
801
- testing .assert_frame_equal (sdf .to_dense (), df )
806
+ tm .assert_frame_equal (sdf .to_dense (), df )
802
807
803
808
def test_sparse_to_dense (self ):
804
809
pass
0 commit comments