Skip to content

Commit

Permalink
TST: cast string to complex (#52855)
Browse files Browse the repository at this point in the history
  • Loading branch information
srkds committed Apr 23, 2023
1 parent 7b710c7 commit fc434c4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pandas/tests/dtypes/test_dtypes.py
Expand Up @@ -1161,6 +1161,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 fc434c4

Please sign in to comment.