所有控股基金['ratioBest']
Out[72]:
65357 0.0
65371 0.0
65394 2.396777442094666
65397 0.0
65433 0.0167993412023058
65462 0.0
65560 0.0
Name: ratioBest, Length: 1664, dtype: object
列是一个对象,我通常使用
allHoldingsFund['ratioBest']=pd.to_numeric(allHoldingsFund['ratioBest'])
但是,当我这样做时,我得到了一个我无法解决的错误:
pd.to_numeric(allHoldingsFund['ratioBest'])
Traceback (most recent call last):
File "/apps/qtrinst/install/python/anaconda/envs/sx_anaconda/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2910, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-71-6f0ccaf63f24>", line 1, in <module>
pd.to_numeric(allHoldingsFund['ratioBest'])
File "/apps/qtrinst/install/python/anaconda/envs/sx_anaconda/lib/python3.5/site-packages/pandas/core/tools/numeric.py", line 133, in to_numeric
coerce_numeric=coerce_numeric)
File "pandas/_libs/src/inference.pyx", line 1111, in pandas._libs.lib.maybe_convert_numeric
TypeError: len() of unsized object
我怎样才能解决这个问题?