Skip to content

Commit

Permalink
TST: cast string to complex (pandas-dev#52855)
Browse files Browse the repository at this point in the history
  • Loading branch information
srkds authored and im-vinicius committed Jul 8, 2023
1 parent b779f43 commit 4c3cffd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pandas/tests/dtypes/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,13 @@ def test_compare_complex_dtypes():
df.lt(df.astype(object))


def test_cast_string_to_complex():
# GH 4895
expected = pd.DataFrame(["1.0+5j", "1.5-3j"], dtype=complex)
result = pd.DataFrame(["1.0+5j", "1.5-3j"]).astype(complex)
tm.assert_frame_equal(result, expected)


def test_multi_column_dtype_assignment():
# GH #27583
df = pd.DataFrame({"a": [0.0], "b": 0.0})
Expand Down

0 comments on commit 4c3cffd

Please sign in to comment.