I have a .excel file with complex number data and want it to convert to complex numpy array.
I tried the following code:
df=pd.read_excel(location, sheet_name='complex')
np_complex=df.to_numpy(dtype=complex)
It has worked previously, although nothing is changed (I think) but now it is raising the error
TypeError: must be real number, not str
In line np_complex=df.to_numpy(dtype=complex)
Can anyone suggest the change in code?

df.dtypesto make sure the data types are correctdf.to_numpy()? This should give a clearer idea of what it's trying to convert to complex. In my tests "1+3j" and "(1+3j)"` both work.