<p>我正在尝试将数据帧中的所有列更改为float,我的代码是-</p>
<pre><code>df = pd.read_csv('Consolidated_train_data.csv')
df.drop(['investment_class', 'currency', 'fund_size','category', 'parent_company', 'fund_name', 'inception_date', 'fund_id'], axis=1, inplace=True)
medianFiller = lambda x: x.fillna(x.median)
df = df.apply(medianFiller, axis=1)
for col in df.columns:
df[col] = df[col].astype('float64')
</code></pre>
<p>但在执行此操作时,我得到了一个错误-</p>
<pre><code>TypeError: float() argument must be a string or a number, not 'method'
</code></pre>