https://www.cnpython.com/qa/466500
https://www.cnblogs.com/focus-z/p/10820718.html
如果您有这样一个字符串:complexStr = "0.015291+0.0075383i"
,您可以:
complexFloat = complex(complexStr[:-1] + 'j')
pandas DataFrame的 applymap() 函数可以对DataFrame里的每个值进行处理,然后返回一个新的DataFrame:
import pandas as pd df = pd.DataFrame({ 'a': [1, 2, 3], 'b': [10, 20, 30], 'c': [5, 10, 15] }) def add_one(x): return x + 1 print df.applymap(add_one)