pandas-use-of-dot-not-null (PD004)
源自 pandas-vet linter。
作用
检查 Pandas 对象上 .notnull 的使用。
为什么这不好?
在 Pandas API 中,.notna 和 .notnull 是等效的。为了保持一致性,优先使用 .notna 而不是 .notnull。
作为名称,.notna 更准确地反映了方法的行为,因为这些方法除了检查 None 值之外,还检查 NaN 和 NaT 值。
示例
建议改为