@@ -3241,25 +3241,40 @@ def test_read_excel_xlwings():
32413241 arr = read_excel (inputpath ('test.xlsx' ), '2d' )
32423242 assert_array_equal (arr , io_2d )
32433243
3244+ arr = read_excel (inputpath ('test.xlsx' ), '2d_classic' )
3245+ assert_array_equal (arr , ndtest ("a=a0..a2; b0..b2" ))
3246+
3247+ arr = read_excel (inputpath ('test.xlsx' ), '2d_classic' , nb_axes = 2 )
3248+ assert_array_equal (arr , ndtest ("a=a0..a2; b0..b2" ))
3249+
32443250 arr = read_excel (inputpath ('test.xlsx' ), '3d' )
32453251 assert_array_equal (arr , io_3d )
32463252
3253+ # for > 2d, specifying nb_axes is required if there is no name for the horizontal axis
3254+ arr = read_excel (inputpath ('test.xlsx' ), '3d_classic' , nb_axes = 3 )
3255+ assert_array_equal (arr , ndtest ("a=1..3; b=b0,b1; c0..c2" ))
3256+
32473257 arr = read_excel (inputpath ('test.xlsx' ), 'int_labels' )
32483258 assert_array_equal (arr , io_int_labels )
32493259
3250- arr = read_excel (inputpath ('test.xlsx' ), '2d_classic' )
3251- assert_array_equal (arr , ndtest ("a=a0..a2; b0..b2" ))
3252-
32533260 # passing a Group as sheet arg
32543261 axis = Axis ('dim=1d,2d,3d,5d' )
32553262
32563263 arr = read_excel (inputpath ('test.xlsx' ), axis ['1d' ])
32573264 assert_array_equal (arr , io_1d )
32583265
3266+ # missing rows, default fill_value
3267+ arr = read_excel (inputpath ('test.xlsx' ), 'missing_values' )
3268+ expected = ndtest ("a=1..3; b=b0,b1; c=c0..c2" , dtype = float )
3269+ expected [2 , 'b0' ] = nan
3270+ expected [3 , 'b1' ] = nan
3271+ assert_array_nan_equal (arr , expected )
3272+
32593273 # missing rows + fill_value argument
32603274 arr = read_excel (inputpath ('test.xlsx' ), 'missing_values' , fill_value = 42 )
3261- expected = io_missing_values .copy ()
3262- expected [isnan (expected )] = 42
3275+ expected = ndtest ("a=1..3; b=b0,b1; c=c0..c2" , dtype = float )
3276+ expected [2 , 'b0' ] = 42
3277+ expected [3 , 'b1' ] = 42
32633278 assert_array_equal (arr , expected )
32643279
32653280 # range
@@ -3325,24 +3340,31 @@ def test_read_excel_pandas():
33253340 arr = read_excel (inputpath ('test.xlsx' ), '1d' , engine = 'xlrd' )
33263341 assert_array_equal (arr , io_1d )
33273342
3328- arr = read_excel (inputpath ('test.xlsx' ), '2d' , nb_axes = 2 , engine = 'xlrd' )
3343+ arr = read_excel (inputpath ('test.xlsx' ), '2d' , engine = 'xlrd' )
33293344 assert_array_equal (arr , io_2d )
33303345
3331- arr = read_excel (inputpath ('test.xlsx' ), '2d' , engine = 'xlrd' )
3346+ arr = read_excel (inputpath ('test.xlsx' ), '2d' , nb_axes = 2 , engine = 'xlrd' )
33323347 assert_array_equal (arr , io_2d )
33333348
3349+ arr = read_excel (inputpath ('test.xlsx' ), '2d_classic' , engine = 'xlrd' )
3350+ assert_array_equal (arr , ndtest ("a=a0..a2; b0..b2" ))
3351+
3352+ arr = read_excel (inputpath ('test.xlsx' ), '2d_classic' , nb_axes = 2 , engine = 'xlrd' )
3353+ assert_array_equal (arr , ndtest ("a=a0..a2; b0..b2" ))
3354+
33343355 arr = read_excel (inputpath ('test.xlsx' ), '3d' , index_col = [0 , 1 ], engine = 'xlrd' )
33353356 assert_array_equal (arr , io_3d )
33363357
33373358 arr = read_excel (inputpath ('test.xlsx' ), '3d' , engine = 'xlrd' )
33383359 assert_array_equal (arr , io_3d )
33393360
3361+ # for > 2d, specifying nb_axes is required if there is no name for the horizontal axis
3362+ arr = read_excel (inputpath ('test.xlsx' ), '3d_classic' , nb_axes = 3 , engine = 'xlrd' )
3363+ assert_array_equal (arr , ndtest ("a=1..3; b=b0,b1; c0..c2" ))
3364+
33403365 arr = read_excel (inputpath ('test.xlsx' ), 'int_labels' , engine = 'xlrd' )
33413366 assert_array_equal (arr , io_int_labels )
33423367
3343- arr = read_excel (inputpath ('test.xlsx' ), '2d_classic' , engine = 'xlrd' )
3344- assert_array_equal (arr , ndtest ("a=a0..a2; b0..b2" ))
3345-
33463368 # passing a Group as sheet arg
33473369 axis = Axis ('dim=1d,2d,3d,5d' )
33483370
@@ -3370,7 +3392,7 @@ def test_read_excel_pandas():
33703392 # missing rows + fill_value argument
33713393 arr = read_excel (inputpath ('test_narrow.xlsx' ), 'missing_values' ,
33723394 fill_value = 42 , wide = False , engine = 'xlrd' )
3373- expected = io_narrow_missing_values
3395+ expected = io_narrow_missing_values . copy ()
33743396 expected [isnan (expected )] = 42
33753397 assert_array_equal (arr , expected )
33763398
0 commit comments