@@ -848,22 +848,27 @@ def assert_slice_ok(mgr, axis, slobj):
848
848
assert_slice_ok (mgr , ax , slice (1 , 4 ))
849
849
assert_slice_ok (mgr , ax , slice (3 , 0 , - 2 ))
850
850
851
- # boolean mask
852
- assert_slice_ok (mgr , ax , np .array ([], dtype = np .bool_ ))
853
- assert_slice_ok (mgr , ax , np .ones (mgr .shape [ax ], dtype = np .bool_ ))
854
- assert_slice_ok (mgr , ax , np .zeros (mgr .shape [ax ], dtype = np .bool_ ))
855
-
856
- if mgr .shape [ax ] >= 3 :
857
- assert_slice_ok (mgr , ax , np .arange (mgr .shape [ax ]) % 3 == 0 )
858
- assert_slice_ok (mgr , ax , np .array ([True , True , False ], dtype = np .bool_ ))
851
+ if mgr .ndim < 2 :
852
+ # 2D only support slice objects
853
+
854
+ # boolean mask
855
+ assert_slice_ok (mgr , ax , np .array ([], dtype = np .bool_ ))
856
+ assert_slice_ok (mgr , ax , np .ones (mgr .shape [ax ], dtype = np .bool_ ))
857
+ assert_slice_ok (mgr , ax , np .zeros (mgr .shape [ax ], dtype = np .bool_ ))
858
+
859
+ if mgr .shape [ax ] >= 3 :
860
+ assert_slice_ok (mgr , ax , np .arange (mgr .shape [ax ]) % 3 == 0 )
861
+ assert_slice_ok (
862
+ mgr , ax , np .array ([True , True , False ], dtype = np .bool_ )
863
+ )
859
864
860
- # fancy indexer
861
- assert_slice_ok (mgr , ax , [])
862
- assert_slice_ok (mgr , ax , list (range (mgr .shape [ax ])))
865
+ # fancy indexer
866
+ assert_slice_ok (mgr , ax , [])
867
+ assert_slice_ok (mgr , ax , list (range (mgr .shape [ax ])))
863
868
864
- if mgr .shape [ax ] >= 3 :
865
- assert_slice_ok (mgr , ax , [0 , 1 , 2 ])
866
- assert_slice_ok (mgr , ax , [- 1 , - 2 , - 3 ])
869
+ if mgr .shape [ax ] >= 3 :
870
+ assert_slice_ok (mgr , ax , [0 , 1 , 2 ])
871
+ assert_slice_ok (mgr , ax , [- 1 , - 2 , - 3 ])
867
872
868
873
@pytest .mark .parametrize ("mgr" , MANAGERS )
869
874
def test_take (self , mgr ):
0 commit comments