@@ -4897,39 +4897,40 @@ def _constructor(self):
4897
4897
data = {"a" : [1 , 2 ], "b" : [3 , 4 ]}
4898
4898
sdf = SubDataFrame (data , dtype = np .intp )
4899
4899
4900
- expected = np . array ([[ 1 , 3 ], [ 2 , 4 ]] , dtype = np .intp )
4900
+ expected = DataFrame ( data , dtype = np .intp )
4901
4901
4902
4902
with ensure_clean_path ("temp.h5" ) as path :
4903
4903
sdf .to_hdf (path , "df" )
4904
- result = read_hdf (path , "df" ). values
4905
- tm .assert_numpy_array_equal (result , expected )
4904
+ result = read_hdf (path , "df" )
4905
+ tm .assert_frame_equal (result , expected )
4906
4906
4907
4907
with ensure_clean_path ("temp.h5" ) as path :
4908
4908
with HDFStore (path ) as store :
4909
4909
store .put ("df" , sdf )
4910
- result = read_hdf (path , "df" ). values
4911
- tm .assert_numpy_array_equal (result , expected )
4910
+ result = read_hdf (path , "df" )
4911
+ tm .assert_frame_equal (result , expected )
4912
4912
4913
4913
def test_supported_for_subclasses_series (self ):
4914
4914
class SubSeries (Series ):
4915
4915
@property
4916
4916
def _constructor (self ):
4917
4917
return SubSeries
4918
4918
4919
- sser = SubSeries ([1 , 2 , 3 ], dtype = np .intp )
4919
+ data = [1 , 2 , 3 ]
4920
+ sser = SubSeries (data , dtype = np .intp )
4920
4921
4921
- expected = np . array ([ 1 , 2 , 3 ] , dtype = np .intp )
4922
+ expected = Series ( data , dtype = np .intp )
4922
4923
4923
4924
with ensure_clean_path ("temp.h5" ) as path :
4924
4925
sser .to_hdf (path , "ser" )
4925
- result = read_hdf (path , "ser" ). values
4926
- tm .assert_numpy_array_equal (result , expected )
4926
+ result = read_hdf (path , "ser" )
4927
+ tm .assert_series_equal (result , expected )
4927
4928
4928
4929
with ensure_clean_path ("temp.h5" ) as path :
4929
4930
with HDFStore (path ) as store :
4930
4931
store .put ("ser" , sser )
4931
- result = read_hdf (path , "ser" ). values
4932
- tm .assert_numpy_array_equal (result , expected )
4932
+ result = read_hdf (path , "ser" )
4933
+ tm .assert_series_equal (result , expected )
4933
4934
4934
4935
4935
4936
@pytest .mark .parametrize ("bad_version" , [(1 , 2 ), (1 ,), [], "12" , "123" ])
0 commit comments