擅长:python、mysql、java
<p>如果你只是写<code>df["A"].astype(float)</code>,你就不会改变<code>df</code>。您需要将<code>astype</code>方法调用的输出分配给其他对象,包括使用<code>df['A'] = df['A'].astype(float)</code>的现有序列。另外,您可能希望按照@user3582076的建议使用numpy,或者在将今天的值除以昨天的值得到的序列上使用<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.apply.html" rel="nofollow noreferrer">^{<cd5>}</a></p>