问题:
I have this DataFrame
and want only the records whose EPS
column is not NaN
: 我有这个DataFrame
,只想要EPS
列不是NaN
的记录:
>>> df
STK_ID EPS cash
STK_ID RPT_Date
601166 20111231 601166 NaN NaN
600036 20111231 600036 NaN 12
600016 20111231 600016 4.3 NaN
601009 20111231 601009 NaN NaN
601939 20111231 601939 2.5 NaN
000001 20111231 000001 NaN NaN
...ie something like df.drop(....)
to get this resulting dataframe: ...例如df.drop(....)
类的东西来获取结果数据df.drop(....)
:
STK_ID EPS cash
STK_ID RPT_Date
600016 20111231 600016 4.3 NaN
601939 20111231 601939 2.5 NaN
How do I do that? 我怎么做?
解决方案:
参考一: https://stackoom.com/question/uHUE/如何删除在特定列中的值为NaN的Pandas-DataFrame行参考二: https://oldbug.net/q/uHUE/How-to-drop-rows-of-Pandas-DataFrame-whose-value-in-a-certain-column-is-NaN
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4349142