I am using pandas which very efficiently sorts/filters the data they way I need.
This code worked fine, until I changed the last column to a complex number; now I ge
I tried implementing the lambda but was getting a error:
ValueError: complex() arg is a malformed string
I found out I had to eliminate the spaces as well as change the 'i' character to 'j' Here's my code:
for tits in df.columns:
if df[tits].dtypes =='O':
df[tits] = df[tits].str.replace('i','j')
df[tits] = df[tits].str.replace(' ','')
df[tits] = df[tits].apply(lambda x: np.complex(x))
print(df[df.columns[1]])
print(df.dtypes)