擅长:python、mysql、java
<pre><code>options = {}
for col in df.columns:
options[col] = 'float64'
df = df.astype(options)
</code></pre>
<p>或直接:</p>
<pre><code>df = df.astype('float64')
</code></pre>
<p>参考<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.astype.html" rel="nofollow noreferrer">Pandas dataframe.astype</a></p>
<p>更新问题:</p>
<p>尝试使用<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html" rel="nofollow noreferrer">Pandas Dataframe.apply method</a>的<code>result_type</code>选项</p>