@@ -911,20 +911,20 @@ def test_sort_values_inplace(obj, kwargs):
911
911
912
912
@pytest .mark .parametrize ("decimals" , [- 1 , 0 , 1 ])
913
913
def test_round (decimals ):
914
- df = DataFrame ({"a" : [1 , 2 ], "b" : "c" })
914
+ df = DataFrame ({"a" : [1 , 2 ], "b" : [ 3.3 , 4.4 ] })
915
915
df_orig = df .copy ()
916
916
df2 = df .round (decimals = decimals )
917
917
918
- assert tm .shares_memory (get_array (df2 , "b" ), get_array (df , "b" ))
918
+ assert not tm .shares_memory (get_array (df2 , "b" ), get_array (df , "b" ))
919
919
# TODO: Make inplace by using out parameter of ndarray.round?
920
920
if decimals >= 0 :
921
921
# Ensure lazy copy if no-op
922
922
assert np .shares_memory (get_array (df2 , "a" ), get_array (df , "a" ))
923
923
else :
924
924
assert not np .shares_memory (get_array (df2 , "a" ), get_array (df , "a" ))
925
925
926
- df2 .iloc [0 , 1 ] = "d"
927
- df2 .iloc [0 , 0 ] = 4
926
+ df2 .iloc [0 , 1 ] = 6.6
927
+ df2 .iloc [0 , 0 ] = 5
928
928
assert not np .shares_memory (get_array (df2 , "b" ), get_array (df , "b" ))
929
929
assert not np .shares_memory (get_array (df2 , "a" ), get_array (df , "a" ))
930
930
tm .assert_frame_equal (df , df_orig )
0 commit comments