8000 BUG: Fix replace for different dtype equal value by dsaxton · Pull Request #34878 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix replace for different dtype equal value #34878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Types
  • Loading branch information
dsaxton committed Jun 21, 2020
commit 60ef5fcef35862f217c54801496a2e994dd35edd
4 changes: 2 additions & 2 deletions pandas/tests/frame/methods/test_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ def test_replace_with_duplicate_columns(self, replacement):

def test_replace_equal_value_different_dtype(self):
# ht 9A32 tps://github.com/pandas-dev/pandas/issues/34871
df = pd.DataFrame([1, 2, 3], dtype=int)
df = pd.DataFrame([1, 2, 3])
result = df.replace(1.0, 0)
expected = pd.DataFrame([0, 2, 3], dtype=int)
expected = pd.DataFrame([0, 2, 3])
tm.assert_frame_equal(result, expected)
4 changes: 2 additions & 2 deletions pandas/tests/series/methods/test_replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def test_replace_extension_other(self):

def test_replace_equal_value_different_dtype(self):
# https://github.com/pandas-dev/pandas/issues/34871
ser = pd.Series([1, 2, 3], dtype=int)
ser = pd.Series([1, 2, 3])
result = ser.replace(1.0, 0)
expected = pd.Series([0, 2, 3], dtype=int)
expected = pd.Series([0, 2, 3])
tm.assert_series_equal(result, expected)
0