@@ -688,43 +688,67 @@ def _combine_panel(self, other, func):
688688
689689 return self ._constructor (result_values , items , major , minor )
690690
691- def major_xs (self , key , copy = True ):
691+ def major_xs (self , key , copy = None ):
692692 """
693693 Return slice of panel along major axis
694694
695695 Parameters
696696 ----------
697697 key : object
698698 Major axis label
699- copy : boolean, default True
700- Copy data
699+ copy : boolean [deprecated]
700+ Whether to make a copy of the data
701701
702702 Returns
703703 -------
704704 y : DataFrame
705705 index -> minor axis, columns -> items
706+
707+ Notes
708+ -----
709+ major_xs is only for getting, not setting values.
710+
711+ MultiIndex Slicers is a generic way to get/set values on any level or levels
712+ it is a superset of major_xs functionality, see :ref:`MultiIndex Slicers <indexing.mi_slicers>`
713+
706714 """
707- return self .xs (key , axis = self ._AXIS_LEN - 2 , copy = copy )
715+ if copy is not None :
716+ warnings .warn ("copy keyword is deprecated, "
717+ "default is to return a copy or a view if possible" )
708718
709- def minor_xs (self , key , copy = True ):
719+ return self .xs (key , axis = self ._AXIS_LEN - 2 )
720+
721+ def minor_xs (self , key , copy = None ):
710722 """
711723 Return slice of panel along minor axis
712724
713725 Parameters
714726 ----------
715727 key : object
716728 Minor axis label
717- copy : boolean, default True
718- Copy data
729+ copy : boolean [deprecated]
730+ Whether to make a copy of the data
719731
720732 Returns
721733 -------
722734 y : DataFrame
723735 index -> major axis, columns -> items
736+
737+ Notes
738+ -----
739+ minor_xs is only for getting, not setting values.
740+
741+ MultiIndex Slicers is a generic way to get/set values on any level or levels
742+ it is a superset of minor_xs functionality, see :ref:`MultiIndex Slicers <indexing.mi_slicers>`
743+
724744 """
725- return self .xs (key , axis = self ._AXIS_LEN - 1 , copy = copy )
745+ if copy is not None :
746+ warnings .warn ("copy keyword is deprecated, "
747+ "default is to return a copy or a view if possible" )
748+
749+ return self .xs (key , axis = self ._AXIS_LEN - 1 )
726750
727- def xs (self , key , axis = 1 , copy = True ):
751+ def xs (self , key , axis = 1 , copy = None ):
728752 """
729753 Return slice of panel along selected axis
730754
@@ -733,24 +757,36 @@ def xs(self, key, axis=1, copy=True):
733757 key : object
734758 Label
735759 axis : {'items', 'major', 'minor}, default 1/'major'
736- copy : boolean, default True
737- Copy data
760+ copy : boolean [deprecated]
761+ Whether to make a copy of the data
738762
739763 Returns
740764 -------
741765 y : ndim(self)-1
766+
767+ Notes
768+ -----
769+ xs is only for getting, not setting values.
770+
771+ MultiIndex Slicers is a generic way to get/set values on any level or levels
772+ it is a superset of xs functionality, see :ref:`MultiIndex Slicers <indexing.mi_slicers>`
773+
742774 """
775+ if copy is not None :
776+ warnings .warn ("copy keyword is deprecated, "
777+ "default is to return a copy or a view if possible" )
778+
743779 axis = self ._get_axis_number (axis )
744780 if axis == 0 :
745- data = self [key ]
746- if copy :
747- data = data .copy ()
748- return data
781+ return self [key ]
749782
750783 self ._consolidate_inplace ()
751784 axis_number = self ._get_axis_number (axis )
752- new_data = self ._data .xs (key , axis = axis_number , copy = copy )
753- return self ._construct_return_type (new_data )
785+ new_data = self ._data .xs (key , axis = axis_number , copy = False )
786+ result = self ._construct_return_type (new_data )
787+ copy = new_data .is_mixed_type
788+ result ._set_is_copy (self , copy = copy )
789+ return result
754790
755791 _xs = xs
756792
0 commit comments