python - 在 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)
解决方案
names = df["Project"].dropna()
for i in names:
if i.isnull():
continue
print(i)
推荐阅读
- oracle - 如果父表中有新值,则触发更新或插入其他表的行/值
- python - make decorator 只有 Content 的创建者可以操作它
- android - 使用导航组件加载片段后如何杀死片段
- php - 删除 WooCommerce 购物车条件(产品的最小数量)
- javascript - 拆分字符串和排序的时间复杂度
- android - 设计 Android 客户端-服务器应用程序的最佳方法是什么
- javascript - 如何在 JavaScript 中以最短的方式创建 { 0: false, 1: false, 2: false, ..., 99: false }(最好使用 Lodash?)
- jenkins - 使用 anyof 的 Jenkins 管道
- sql - 雪花中的 SELECT DISTINCT 或 GROUP BY 更快吗?
- sql-server - 是否可以改进视图的“包含”过滤器?