首页 > 解决方案 > 在 pandas 中跳过 nan

问题描述

我在 CSV 中有两列。一是URL等项目。在阅读项目专栏时,我得到 A, B, nan, nan, nan

如何只为 A 和 B 运行循环并跳过所有非循环。

names=df.Project.tolist()
for i in names:
   if i.isnull():
     continue
   print(i)

标签: pythonpandas

解决方案


names = df["Project"].dropna()
for i in names:
   if i.isnull():
     continue
   print(i)

推荐阅读