File tree 2 files changed +12
-26
lines changed
2 files changed +12
-26
lines changed Original file line number Diff line number Diff line change @@ -676,22 +676,15 @@ def test_identity_slice_returns_new_object(self):
676
676
original_series [:3 ] = [7 , 8 , 9 ]
677
677
assert all (sliced_series [:3 ] == [7 , 8 , 9 ])
678
678
679
- def test_indexing_zero_dim_np_array (self ):
679
+ def test_indexing_zerodim_np_array (self ):
680
680
# GH24919
681
681
df = DataFrame ([[1 , 2 ], [3 , 4 ]])
682
-
683
- # should not raise an error
684
682
result = df .iloc [np .array (0 )]
683
+ s = pd .Series ([1 , 2 ], name = 0 )
684
+ tm .assert_series_equal (result , s )
685
685
686
- # expected series
687
- sr = pd .Series ([1 , 2 ], name = 0 )
688
- tm .assert_series_equal (result , sr )
689
-
690
- def test_series_indexing_zero_dim_np_array (self ):
686
+ def test_series_indexing_zerodim_np_array (self ):
691
687
# GH24919
692
- sr = Series ([1 , 2 ])
693
-
694
- # should not raise an error
695
- result = sr .iloc [np .array (0 )]
696
-
688
+ s = Series ([1 , 2 ])
689
+ result = s .iloc [np .array (0 )]
697
690
assert result == 1
Original file line number Diff line number Diff line change @@ -766,22 +766,15 @@ def test_loc_setitem_empty_append_raises(self):
766
766
with pytest .raises (ValueError , match = msg ):
767
767
df .loc [0 :2 , 'x' ] = data
768
768
769
- def test_indexing_zero_dim_np_array (self ):
769
+ def test_indexing_zerodim_np_array (self ):
770
770
# GH24924
771
771
df = DataFrame ([[1 , 2 ], [3 , 4 ]])
772
-
773
- # should not raise an error
774
772
result = df .loc [np .array (0 )]
773
+ s = pd .Series ([1 , 2 ], name = 0 )
774
+ tm .assert_series_equal (result , s )
775
775
776
- # expected series
777
- sr = pd .Series ([1 , 2 ], name = 0 )
778
- tm .assert_series_equal (result , sr )
779
-
780
- def test_series_indexing_zero_dim_np_array (self ):
776
+ def test_series_indexing_zerodim_np_array (self ):
781
777
# GH24924
782
- sr = Series ([1 , 2 ])
783
-
784
- # should not raise an error
785
- result = sr .loc [np .array (0 )]
786
-
778
+ s = Series ([1 , 2 ])
779
+ result = s .loc [np .array (0 )]
787
780
assert result == 1
You can’t perform that action at this time.
0 commit comments