@@ -108,7 +108,7 @@ class NDFrame(PandasObject, SelectionMixin):
108108 axes : list
109109 copy : boolean, default False
110110 """
111- _internal_names = ['_data' , '_cacher' , '_item_cache' , '_cache' , 'is_copy ' ,
111+ _internal_names = ['_data' , '_cacher' , '_item_cache' , '_cache' , '_is_copy ' ,
112112 '_subtyp' , '_name' , '_index' , '_default_kind' ,
113113 '_default_fill_value' , '_metadata' , '__array_struct__' ,
114114 '__array_interface__' ]
@@ -117,7 +117,7 @@ class NDFrame(PandasObject, SelectionMixin):
117117 _deprecations = frozenset (['as_blocks' , 'blocks' ,
118118 'consolidate' , 'convert_objects' ])
119119 _metadata = []
120- is_copy = None
120+ _is_copy = None
121121
122122 def __init__ (self , data , axes = None , copy = False , dtype = None ,
123123 fastpath = False ):
@@ -132,10 +132,22 @@ def __init__(self, data, axes=None, copy=False, dtype=None,
132132 for i , ax in enumerate (axes ):
133133 data = data .reindex_axis (ax , axis = i )
134134
135- object .__setattr__ (self , 'is_copy ' , None )
135+ object .__setattr__ (self , '_is_copy ' , None )
136136 object .__setattr__ (self , '_data' , data )
137137 object .__setattr__ (self , '_item_cache' , {})
138138
139+ @property
140+ def is_copy (self ):
141+ warnings .warn ("Attribute 'is_copy' will be removed in a future "
142+ "version." , FutureWarning , stacklevel = 2 )
143+ return self ._is_copy
144+
145+ @is_copy .setter
146+ def is_copy (self , msg ):
147+ warnings .warn ("Attribute 'is_copy' will be removed in a future "
148+ "version." , FutureWarning , stacklevel = 2 )
149+ self ._is_copy = msg
150+
139151 def _repr_data_resource_ (self ):
140152 """
141153 Not a real Jupyter special repr method, but we use the same
@@ -2153,7 +2165,7 @@ def _get_item_cache(self, item):
21532165 res ._set_as_cached (item , self )
21542166
21552167 # for a chain
2156- res .is_copy = self .is_copy
2168+ res ._is_copy = self ._is_copy
21572169 return res
21582170
21592171 def _set_as_cached (self , item , cacher ):
@@ -2264,12 +2276,12 @@ def _set_item(self, key, value):
22642276
22652277 def _set_is_copy (self , ref = None , copy = True ):
22662278 if not copy :
2267- self .is_copy = None
2279+ self ._is_copy = None
22682280 else :
22692281 if ref is not None :
2270- self .is_copy = weakref .ref (ref )
2282+ self ._is_copy = weakref .ref (ref )
22712283 else :
2272- self .is_copy = None
2284+ self ._is_copy = None
22732285
22742286 def _check_is_chained_assignment_possible (self ):
22752287 """
@@ -2288,7 +2300,7 @@ def _check_is_chained_assignment_possible(self):
22882300 self ._check_setitem_copy (stacklevel = 4 , t = 'referant' ,
22892301 force = True )
22902302 return True
2291- elif self .is_copy :
2303+ elif self ._is_copy :
22922304 self ._check_setitem_copy (stacklevel = 4 , t = 'referant' )
22932305 return False
22942306
@@ -2323,7 +2335,7 @@ def _check_setitem_copy(self, stacklevel=4, t='setting', force=False):
23232335
23242336 """
23252337
2326- if force or self .is_copy :
2338+ if force or self ._is_copy :
23272339
23282340 value = config .get_option ('mode.chained_assignment' )
23292341 if value is None :
@@ -2333,23 +2345,23 @@ def _check_setitem_copy(self, stacklevel=4, t='setting', force=False):
23332345 # the copy weakref
23342346 try :
23352347 gc .collect (2 )
2336- if not gc .get_referents (self .is_copy ()):
2337- self .is_copy = None
2348+ if not gc .get_referents (self ._is_copy ()):
2349+ self ._is_copy = None
23382350 return
23392351 except Exception :
23402352 pass
23412353
23422354 # we might be a false positive
23432355 try :
2344- if self .is_copy ().shape == self .shape :
2345- self .is_copy = None
2356+ if self ._is_copy ().shape == self .shape :
2357+ self ._is_copy = None
23462358 return
23472359 except Exception :
23482360 pass
23492361
23502362 # a custom message
2351- if isinstance (self .is_copy , string_types ):
2352- t = self .is_copy
2363+ if isinstance (self ._is_copy , string_types ):
2364+ t = self ._is_copy
23532365
23542366 elif t == 'referant' :
23552367 t = ("\n "
0 commit comments