@@ -3241,25 +3241,40 @@ def test_read_excel_xlwings():
3241
3241
arr = read_excel (inputpath ('test.xlsx' ), '2d' )
3242
3242
assert_array_equal (arr , io_2d )
3243
3243
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
+
3244
3250
arr = read_excel (inputpath ('test.xlsx' ), '3d' )
3245
3251
assert_array_equal (arr , io_3d )
3246
3252
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
+
3247
3257
arr = read_excel (inputpath ('test.xlsx' ), 'int_labels' )
3248
3258
assert_array_equal (arr , io_int_labels )
3249
3259
3250
- arr = read_excel (inputpath ('test.xlsx' ), '2d_classic' )
3251
- assert_array_equal (arr , ndtest ("a=a0..a2; b0..b2" ))
3252
-
3253
3260
# passing a Group as sheet arg
3254
3261
axis = Axis ('dim=1d,2d,3d,5d' )
3255
3262
3256
3263
arr = read_excel (inputpath ('test.xlsx' ), axis ['1d' ])
3257
3264
assert_array_equal (arr , io_1d )
3258
3265
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
+
3259
3273
# missing rows + fill_value argument
3260
3274
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
3263
3278
assert_array_equal (arr , expected )
3264
3279
3265
3280
# range
@@ -3325,24 +3340,31 @@ def test_read_excel_pandas():
3325
3340
arr = read_excel (inputpath ('test.xlsx' ), '1d' , engine = 'xlrd' )
3326
3341
assert_array_equal (arr , io_1d )
3327
3342
3328
- arr = read_excel (inputpath ('test.xlsx' ), '2d' , nb_axes = 2 , engine = 'xlrd' )
3343
+ arr = read_excel (inputpath ('test.xlsx' ), '2d' , engine = 'xlrd' )
3329
3344
assert_array_equal (arr , io_2d )
3330
3345
3331
- arr = read_excel (inputpath ('test.xlsx' ), '2d' , engine = 'xlrd' )
3346
+ arr = read_excel (inputpath ('test.xlsx' ), '2d' , nb_axes = 2 , engine = 'xlrd' )
3332
3347
assert_array_equal (arr , io_2d )
3333
3348
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
+
3334
3355
arr = read_excel (inputpath ('test.xlsx' ), '3d' , index_col = [0 , 1 ], engine = 'xlrd' )
3335
3356
assert_array_equal (arr , io_3d )
3336
3357
3337
3358
arr = read_excel (inputpath ('test.xlsx' ), '3d' , engine = 'xlrd' )
3338
3359
assert_array_equal (arr , io_3d )
3339
3360
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
+
3340
3365
arr = read_excel (inputpath ('test.xlsx' ), 'int_labels' , engine = 'xlrd' )
3341
3366
assert_array_equal (arr , io_int_labels )
3342
3367
3343
- arr = read_excel (inputpath ('test.xlsx' ), '2d_classic' , engine = 'xlrd' )
3344
- assert_array_equal (arr , ndtest ("a=a0..a2; b0..b2" ))
3345
-
3346
3368
# passing a Group as sheet arg
3347
3369
axis = Axis ('dim=1d,2d,3d,5d' )
3348
3370
@@ -3370,7 +3392,7 @@ def test_read_excel_pandas():
3370
3392
# missing rows + fill_value argument
3371
3393
arr = read_excel (inputpath ('test_narrow.xlsx' ), 'missing_values' ,
3372
3394
fill_value = 42 , wide = False , engine = 'xlrd' )
3373
- expected = io_narrow_missing_values
3395
+ expected = io_narrow_missing_values . copy ()
3374
3396
expected [isnan (expected )] = 42
3375
3397
assert_array_equal (arr , expected )
3376
3398
0 commit comments