@@ -588,7 +588,7 @@ def fillna(self, value=None, method='pad'):
588
588
divide = _wide_arith_method (operator .div , 'divide' )
589
589
multiply = _wide_arith_method (operator .mul , 'multiply' )
590
590
591
- def major_xs (self , key ):
591
+ def major_xs (self , key , copy = True ):
592
592
"""
593
593
Return slice of panel along major axis
594
594
@@ -602,11 +602,10 @@ def major_xs(self, key):
602
602
y : DataFrame
603
603
index -> minor axis, columns -> items
604
604
"""
605
- loc = self .major_axis .get_loc (key )
606
- mat = np .array (self .values [:, loc , :].T )
607
- return DataFrame (mat , index = self .minor_axis , columns = self .items )
605
+ values = self ._data .xs (key , axis = 1 , copy = copy ).T
606
+ return DataFrame (values , index = self .minor_axis , columns = self .items )
608
607
609
- def minor_xs (self , key ):
608
+ def minor_xs (self , key , copy = False ):
610
609
"""
611
610
Return slice of panel along minor axis
612
611
@@ -620,9 +619,8 @@ def minor_xs(self, key):
620
619
y : DataFrame
621
620
index -> major axis, columns -> items
622
621
"""
623
- loc = self .minor_axis .get_loc (key )
624
- mat = np .array (self .values [:, :, loc ].T )
625
- return DataFrame (mat , index = self .major_axis , columns = self .items )
622
+ values = self ._data .xs (key , axis = 2 , copy = copy ).T
623
+ return DataFrame (values , index = self .major_axis , columns = self .items )
626
624
627
625
def getMinorXS (self , key ): # pragma: no cover
628
626
warnings .warn ("getMinorXS has been replaced by the minor_xs function "
0 commit comments