@@ -433,6 +433,9 @@ def test_where_object(self, index_or_series, fill_val, exp_dtype):
433
433
)
434
434
def test_where_int64 (self , index_or_series , fill_val , exp_dtype , request ):
435
435
klass = index_or_series
436
+ if klass is pd .Index and exp_dtype is np .complex128 :
437
+ mark = pytest .mark .xfail (reason = "Complex Index not supported" )
438
+ request .node .add_marker (mark )
436
439
437
440
obj = klass ([1 , 2 , 3 , 4 ])
438
441
assert obj .dtype == np .int64
@@ -444,6 +447,9 @@ def test_where_int64(self, index_or_series, fill_val, exp_dtype, request):
444
447
)
445
448
def test_where_float64 (self , index_or_series , fill_val , exp_dtype , request ):
446
449
klass = index_or_series
450
+ if klass is pd .Index and exp_dtype is np .complex128 :
451
+ mark = pytest .mark .xfail (reason = "Complex Index not supported" )
452
+ request .node .add_marker (mark )
447
453
448
454
obj = klass ([1.1 , 2.2 , 3.3 , 4.4 ])
449
455
assert obj .dtype == np .float64
@@ -458,8 +464,8 @@ def test_where_float64(self, index_or_series, fill_val, exp_dtype, request):
458
464
(True , object ),
459
465
],
460
466
)
461
- def test_where_series_complex128 (self , index_or_series , fill_val , exp_dtype ):
462
- klass = index_or_series
467
+ def test_where_series_complex128 (self , fill_val , exp_dtype ):
468
+ klass = pd . Series # TODO: use index_or_series once we have Index[complex]
463
469
obj = klass ([1 + 1j , 2 + 2j , 3 + 3j , 4 + 4j ])
464
470
assert obj .dtype == np .complex128
465
471
self ._run_test (obj , fill_val , klass , exp_dtype )
@@ -618,6 +624,11 @@ def test_fillna_float64(self, index_or_series, fill_val, fill_dtype):
618
624
assert obj .dtype == np .float64
619
625
620
626
exp = klass ([1.1 , fill_val , 3.3 , 4.4 ])
627
+ # float + complex -> we don't support a complex Index
628
+ # complex for Series,
629
+ # object for Index
630
+ if fill_dtype == np .complex128 and klass == pd .Index :
631
+ fill_dtype = object
621
632
self ._assert_fillna_conversion (obj , fill_val , exp , fill_dtype )
622
633
623
634
@pytest .mark .parametrize (
0 commit comments