@@ -1776,19 +1776,19 @@ def test_detect_chained_assignment(self):
1776
1776
# work with the chain
1777
1777
expected = DataFrame ([[- 5 ,1 ],[- 6 ,3 ]],columns = list ('AB' ))
1778
1778
df = DataFrame (np .arange (4 ).reshape (2 ,2 ),columns = list ('AB' ),dtype = 'int64' )
1779
- self .assert_ (not df ._is_copy )
1779
+ self .assert_ (not df .is_copy )
1780
1780
1781
1781
df ['A' ][0 ] = - 5
1782
1782
df ['A' ][1 ] = - 6
1783
1783
assert_frame_equal (df , expected )
1784
1784
1785
1785
expected = DataFrame ([[- 5 ,2 ],[np .nan ,3. ]],columns = list ('AB' ))
1786
1786
df = DataFrame ({ 'A' : Series (range (2 ),dtype = 'int64' ), 'B' : np .array (np .arange (2 ,4 ),dtype = np .float64 )})
1787
- self .assert_ (not df ._is_copy )
1787
+ self .assert_ (not df .is_copy )
1788
1788
df ['A' ][0 ] = - 5
1789
1789
df ['A' ][1 ] = np .nan
1790
1790
assert_frame_equal (df , expected )
1791
- self .assert_ (not df ['A' ]._is_copy )
1791
+ self .assert_ (not df ['A' ].is_copy )
1792
1792
1793
1793
# using a copy (the chain), fails
1794
1794
df = DataFrame ({ 'A' : Series (range (2 ),dtype = 'int64' ), 'B' : np .array (np .arange (2 ,4 ),dtype = np .float64 )})
@@ -1800,7 +1800,7 @@ def f():
1800
1800
df = DataFrame ({'a' : ['one' , 'one' , 'two' ,
1801
1801
'three' , 'two' , 'one' , 'six' ],
1802
1802
'c' : Series (range (7 ),dtype = 'int64' ) })
1803
- self .assert_ (not df ._is_copy )
1803
+ self .assert_ (not df .is_copy )
1804
1804
expected = DataFrame ({'a' : ['one' , 'one' , 'two' ,
1805
1805
'three' , 'two' , 'one' , 'six' ],
1806
1806
'c' : [42 ,42 ,2 ,3 ,4 ,42 ,6 ]})
@@ -1826,10 +1826,10 @@ def f():
1826
1826
with tm .assert_produces_warning (expected_warning = com .SettingWithCopyWarning ):
1827
1827
df .loc [0 ]['A' ] = 111
1828
1828
1829
- # make sure that _is_copy is picked up reconstruction
1829
+ # make sure that is_copy is picked up reconstruction
1830
1830
# GH5475
1831
1831
df = DataFrame ({"A" : [1 ,2 ]})
1832
- self .assert_ (df ._is_copy is False )
1832
+ self .assert_ (df .is_copy is False )
1833
1833
with tm .ensure_clean ('__tmp__pickle' ) as path :
1834
1834
df .to_pickle (path )
1835
1835
df2 = pd .read_pickle (path )
@@ -1854,21 +1854,21 @@ def random_text(nobs=100):
1854
1854
1855
1855
# always a copy
1856
1856
x = df .iloc [[0 ,1 ,2 ]]
1857
- self .assert_ (x ._is_copy is True )
1857
+ self .assert_ (x .is_copy is True )
1858
1858
x = df .iloc [[0 ,1 ,2 ,4 ]]
1859
- self .assert_ (x ._is_copy is True )
1859
+ self .assert_ (x .is_copy is True )
1860
1860
1861
1861
# explicity copy
1862
1862
indexer = df .letters .apply (lambda x : len (x ) > 10 )
1863
1863
df = df .ix [indexer ].copy ()
1864
- self .assert_ (df ._is_copy is False )
1864
+ self .assert_ (df .is_copy is False )
1865
1865
df ['letters' ] = df ['letters' ].apply (str .lower )
1866
1866
1867
1867
# implicity take
1868
1868
df = random_text (100000 )
1869
1869
indexer = df .letters .apply (lambda x : len (x ) > 10 )
1870
1870
df = df .ix [indexer ]
1871
- self .assert_ (df ._is_copy is True )
1871
+ self .assert_ (df .is_copy is True )
1872
1872
df .loc [:,'letters' ] = df ['letters' ].apply (str .lower )
1873
1873
1874
1874
# this will raise
@@ -1880,7 +1880,7 @@ def random_text(nobs=100):
1880
1880
1881
1881
# an identical take, so no copy
1882
1882
df = DataFrame ({'a' : [1 ]}).dropna ()
1883
- self .assert_ (df ._is_copy is False )
1883
+ self .assert_ (df .is_copy is False )
1884
1884
df ['a' ] += 1
1885
1885
1886
1886
pd .set_option ('chained_assignment' ,'warn' )
0 commit comments