Skip to content

Commit 1244bde

Browse files
committed
updated copy_view test to reflect that round should only be used on numeric dfs
1 parent 3ebeec7 commit 1244bde

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/tests/copy_view/test_methods.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,20 +911,20 @@ def test_sort_values_inplace(obj, kwargs):
911911

912912
@pytest.mark.parametrize("decimals", [-1, 0, 1])
913913
def test_round(decimals):
914-
df = DataFrame({"a": [1, 2], "b": "c"})
914+
df = DataFrame({"a": [1, 2], "b": [3.3, 4.4]})
915915
df_orig = df.copy()
916916
df2 = df.round(decimals=decimals)
917917

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"))
919919
# TODO: Make inplace by using out parameter of ndarray.round?
920920
if decimals >= 0:
921921
# Ensure lazy copy if no-op
922922
assert np.shares_memory(get_array(df2, "a"), get_array(df, "a"))
923923
else:
924924
assert not np.shares_memory(get_array(df2, "a"), get_array(df, "a"))
925925

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
928928
assert not np.shares_memory(get_array(df2, "b"), get_array(df, "b"))
929929
assert not np.shares_memory(get_array(df2, "a"), get_array(df, "a"))
930930
tm.assert_frame_equal(df, df_orig)

0 commit comments

Comments
 (0)