@@ -37,27 +37,19 @@ def sparse_series_dict(self):
3737 d ["b" ] = 1
3838 d ["a" ] = 0
3939 d ["c" ] = 2
40- return pandas .SparseSeries ( d )
40+ return pandas .Series ( d , dtype = 'Sparse[int]' )
4141
4242 def sparse_series_dict_indexed (self ):
4343 constructor_dict = {1 : 1.0 }
4444 index = [0 , 1 , 2 ]
4545 # Series with index passed in
46- series = pandas .Series (constructor_dict )
47- return pandas .SparseSeries (series , index = index )
48-
49- def sparse_series_list_fill_zero (self ):
50- return pandas .SparseArray ([1 , 0 , 3 , 0 ], dtype = numpy .int64 , fill_value = 0 )
51-
52- def sparse_series_date (self ):
53- arr , index = self .create_numpy_data_nan ()
54- date_index = pandas .bdate_range ("1/1/2011" , periods = len (index ))
55- return pandas .SparseSeries (arr , index = date_index , kind = "block" , name = "bseries" )
46+ series = pandas .Series (constructor_dict , dtype = 'Sparse[float]' )
47+ return pandas .Series (series , index = index )
5648
5749 def multiindex_series (self ):
5850 mi = pandas .MultiIndex (
5951 levels = [["a" , "b" ], ["x" , "y" ], [0 ]],
60- labels = [
52+ codes = [
6153 [1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 ],
6254 [0 , 0 , 1 , 1 , 0 , 0 , 1 , 1 ],
6355 [0 , - 1 , 0 , - 1 , 0 , - 1 , 0 , - 1 ],
@@ -192,24 +184,6 @@ def test_sparse_from_dict_indexed_as_dataset(self):
192184 pandas_series_head = "dataset" ,
193185 )
194186
195- # sparse array with zeros
196- def test_sparse_array_as_numpy (self ):
197- sparse_s = self .sparse_series_list_fill_zero ()
198- self .export_compare (
199- sparse_s ,
200- wl = b'BinaryDeserialize[ByteArray["ODrCAwEEAQAAAAAAAAADAAAAAAAAAA=="]]' ,
201- wxf = b"8:\xc2 \x03 \x01 \x04 \x01 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x03 \x00 \x00 \x00 \x00 \x00 \x00 \x00 " ,
202- )
203-
204- # timeseries
205- def test_timeseries (self ):
206- ts = self .sparse_series_date ()
207- self .export_compare (
208- ts ,
209- wl = b'TimeSeries[{{DateObject[{2011, 1, 3, 0, 0, 0.}, "Instant", "Gregorian", $TimeZone], 0.}, {DateObject[{2011, 1, 4, 0, 0, 0.}, "Instant", "Gregorian", $TimeZone], Indeterminate}, {DateObject[{2011, 1, 5, 0, 0, 0.}, "Instant", "Gregorian", $TimeZone], 2.}, {DateObject[{2011, 1, 6, 0, 0, 0.}, "Instant", "Gregorian", $TimeZone], Indeterminate}, {DateObject[{2011, 1, 7, 0, 0, 0.}, "Instant", "Gregorian", $TimeZone], 4.}}]' ,
210- wxf = b"8:f\x01 s\n TimeSeriesf\x05 s\x04 Listf\x02 s\x04 Listf\x04 s\n DateObjectf\x06 s\x04 Listj\xdb \x07 C\x01 C\x03 C\x00 C\x00 r\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 S\x07 InstantS\t Gregorians\t $TimeZoner\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 f\x02 s\x04 Listf\x04 s\n DateObjectf\x06 s\x04 Listj\xdb \x07 C\x01 C\x04 C\x00 C\x00 r\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 S\x07 InstantS\t Gregorians\t $TimeZones\r Indeterminatef\x02 s\x04 Listf\x04 s\n DateObjectf\x06 s\x04 Listj\xdb \x07 C\x01 C\x05 C\x00 C\x00 r\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 S\x07 InstantS\t Gregorians\t $TimeZoner\x00 \x00 \x00 \x00 \x00 \x00 \x00 @f\x02 s\x04 Listf\x04 s\n DateObjectf\x06 s\x04 Listj\xdb \x07 C\x01 C\x06 C\x00 C\x00 r\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 S\x07 InstantS\t Gregorians\t $TimeZones\r Indeterminatef\x02 s\x04 Listf\x04 s\n DateObjectf\x06 s\x04 Listj\xdb \x07 C\x01 C\x07 C\x00 C\x00 r\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 S\x07 InstantS\t Gregorians\t $TimeZoner\x00 \x00 \x00 \x00 \x00 \x00 \x10 @" ,
211- )
212-
213187 # multi index
214188 def test_multiindex_as_assoc (self ):
215189 s = self .multiindex_series ()
0 commit comments