@@ -741,7 +741,7 @@ def test_impl(df):
741
741
np .testing .assert_array_equal (sdc_func (df ), test_impl (df ))
742
742
743
743
@skip_sdc_jit
744
- @dfRefactoringNotImplemented
744
+ @dfRefactoringNotImplemented # required re-implementing DataFrame unboxing
745
745
def test_index_attribute (self ):
746
746
index_to_test = [[1 , 2 , 3 , 4 , 5 ],
747
747
[.1 , .2 , .3 , .4 , .5 ],
@@ -757,7 +757,7 @@ def test_index_attribute(self):
757
757
self ._test_df_index (df )
758
758
759
759
@skip_sdc_jit
760
- @dfRefactoringNotImplemented
760
+ @dfRefactoringNotImplemented # required re-implementing DataFrame unboxing
761
761
def test_index_attribute_empty (self ):
762
762
n = 5
763
763
np .random .seed (0 )
@@ -768,11 +768,45 @@ def test_index_attribute_empty(self):
768
768
self ._test_df_index (df )
769
769
770
770
@skip_sdc_jit
771
- @dfRefactoringNotImplemented
771
+ @dfRefactoringNotImplemented # required re-implementing DataFrame unboxing
772
772
def test_index_attribute_empty_df (self ):
773
773
df = pd .DataFrame ()
774
774
self ._test_df_index (df )
775
775
776
+ def test_index_attribute_no_unboxing (self ):
777
+ def test_impl (n , index ):
778
+ np .random .seed (0 )
779
+ df = pd .DataFrame ({
780
+ 'A' : np .ones (n ),
781
+ 'B' : np .random .ranf (n )
782
+ }, index = index )
783
+ return df .index
784
+
785
+ sdc_impl = self .jit (test_impl )
786
+ index_to_test = [
787
+ [1 , 2 , 3 , 4 , 5 ],
788
+ [.1 , .2 , .3 , .4 , .5 ],
789
+ ['a' , 'b' , 'c' , 'd' , 'e' ]
790
+ ]
791
+ for index in index_to_test :
792
+ with self .subTest (index = index ):
793
+ n = len (index )
794
+ jit_result = sdc_impl (n , index )
795
+ ref_result = test_impl (n , index )
796
+ np .testing .assert_array_equal (jit_result , ref_result )
797
+
798
+ def test_index_attribute_default_no_unboxing (self ):
799
+ def test_impl (n ):
800
+ np .random .seed (0 )
801
+ df = pd .DataFrame ({
802
+ 'A' : np .ones (n ),
803
+ 'B' : np .random .ranf (n )
804
+ })
805
+ return df .index
806
+
807
+ sdc_impl = self .jit (test_impl )
808
+ np .testing .assert_array_equal (sdc_impl (10 ), test_impl (10 ))
809
+
776
810
@skip_sdc_jit
777
811
@skip_numba_jit
778
812
def test_df_apply (self ):
0 commit comments