astype/convert_objects should be able to do this type of coercion from string complex looking

In [45]: Series(['1.0+5j','1.5-3j']).apply(lambda x: np.complex(x))
Out[45]: 
0      (1+5j)
1    (1.5-3j)
dtype: complex128

http://stackoverflow.com/questions/18919699/python-pandas-complex-number/18919965#18919965

Comment From: abkosar

@mroeschke This looks a bit old, but is this still available to work on?

And the as_type method, is it pandas.Series.as_type or pandas.DataFrame.as_type?

Also I think convert_objects is deprecated and it is now convert_dtypes?

Comment From: rhshadrach

Looks like this work on main:

print(Series(['1.0+5j', '1.5-3j']).astype(complex))
# 0    1.0+5.0j
# 1    1.5-3.0j
# dtype: complex128

print(DataFrame(['1.0+5j', '1.5-3j']).astype(complex))
#           0
# 0  1.0+5.0j
# 1  1.5-3.0j

Marking this as needs tests for now. Maybe this was reported in another (duplicate) issue and closed purposefully? I would recommend searching the issue tracker and/or tests before adding them.

Comment From: srkds

take