@@ -1687,31 +1687,31 @@ def test_detect_chained_assignment(self):
1687
1687
1688
1688
# work with the chain
1689
1689
expected = DataFrame ([[- 5 ,1 ],[- 6 ,3 ]],columns = list ('AB' ))
1690
- df = DataFrame (np .arange (4 ).reshape (2 ,2 ),columns = list ('AB' ))
1690
+ df = DataFrame (np .arange (4 ).reshape (2 ,2 ),columns = list ('AB' ), dtype = 'int64' )
1691
1691
self .assert_ (not df ._is_copy )
1692
1692
1693
1693
df ['A' ][0 ] = - 5
1694
1694
df ['A' ][1 ] = - 6
1695
1695
assert_frame_equal (df , expected )
1696
1696
1697
1697
expected = DataFrame ([[- 5 ,2 ],[np .nan ,3. ]],columns = list ('AB' ))
1698
- df = DataFrame ({ 'A' : np . arange ( 2 ), 'B' : np .array (np .arange (2 ,4 ),dtype = np .float64 )})
1698
+ df = DataFrame ({ 'A' : Series ( range ( 2 ), dtype = 'int64' ), 'B' : np .array (np .arange (2 ,4 ),dtype = np .float64 )})
1699
1699
self .assert_ (not df ._is_copy )
1700
1700
df ['A' ][0 ] = - 5
1701
1701
df ['A' ][1 ] = np .nan
1702
1702
assert_frame_equal (df , expected )
1703
1703
self .assert_ (not df ['A' ]._is_copy )
1704
1704
1705
1705
# using a copy (the chain), fails
1706
- df = DataFrame ({ 'A' : np . arange ( 2 ), 'B' : np .array (np .arange (2 ,4 ),dtype = np .float64 )})
1706
+ df = DataFrame ({ 'A' : Series ( range ( 2 ), dtype = 'int64' ), 'B' : np .array (np .arange (2 ,4 ),dtype = np .float64 )})
1707
1707
def f ():
1708
1708
df .loc [0 ]['A' ] = - 5
1709
1709
self .assertRaises (com .SettingWithCopyError , f )
1710
1710
1711
1711
# doc example
1712
1712
df = DataFrame ({'a' : ['one' , 'one' , 'two' ,
1713
1713
'three' , 'two' , 'one' , 'six' ],
1714
- 'c' : np . arange ( 7 ) })
1714
+ 'c' : Series ( range ( 7 ), dtype = 'int64' ) })
1715
1715
self .assert_ (not df ._is_copy )
1716
1716
expected = DataFrame ({'a' : ['one' , 'one' , 'two' ,
1717
1717
'three' , 'two' , 'one' , 'six' ],
0 commit comments