擅长:python、mysql、java
<p>可以转换为熊猫系列并返回到列表</p>
<pre><code>pd.Series(listname).fillna(0).tolist()
</code></pre>
<p>考虑一下列表<code>listname</code></p>
<pre><code>listname = [1, np.nan, 2, None, 3]
</code></pre>
<p>那么</p>
<pre><code>pd.Series(listname, dtype=object).fillna(0).tolist()
[1, 0, 2, 0, 3]
</code></pre>