仅在 pandas 中保留有限的条目 [英] Keep finite entries only in Pandas
本文介绍了仅在 pandas 中保留有限的条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在熊猫中,我可以使用df.dropna()
删除任何NaN
条目.在Pandas中是否有类似的东西可以删除非限定(例如Inf
)条目?
In Pandas, I can use df.dropna()
to drop any NaN
entries. Is there anything similar in Pandas to drop non-finite (e.g. Inf
) entries?
推荐答案
您可以使用:
with pd.option_context('mode.use_inf_as_null', True):
df = df.dropna()
这篇关于仅在 pandas 中保留有限的条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文