【发布时间】:2017-06-28 05:16:51
【问题描述】:
如何获取 Pandas 中有 NAN 值的所有位置。例如,
sample = pd.DataFrame(np.zeros(shape=[5,5]))
sample.iloc[0,0] = np.nan
sample.iloc[2,3] = np.nan
sample.iloc[4,3] = np.nan
是一个 Pandas 数据框,其中 (0,0)、(2,3) 和 (4,3) 等位置具有 nan 值。因此,我想要一个这样的元组列表
[(0,0),(2,3),(4,3)]
我能得到这个吗?
问候
【问题讨论】:
-
已有很多重复,请使用搜索功能。