【发布时间】:2021-08-22 18:15:18
【问题描述】:
Dataframe如下图:
col_a1, col_a2, col_a3, col_b1, col_b2, col_b3,col_c1, col_c2, col_c3
878 def ert 123 nan nan 001 ert yui
999 erf qaz 345 nan nan 765 jkl dfg
条件:
> if col_a2 and col_a3 is null or empty them drop col_a1,col_a2,col_a3
> if col_b2 and col_b3 is null or empty them drop col_b1,col_b2,col_b3
> if col_c2 and col_c3 is null or empty them drop col_c1,col_c2,col_c3
最终的数据框应该是:
col_a1, col_a2, col_a3,col_c1, col_c2, col_c3
878 def ert 001 ert yui
999 erf qaz 765 jkl dfg
【问题讨论】:
-
请提供示例数据框以及预期结果;那么帮助就更容易了。
-
已添加:) @Cleb
-
“null 或空”是什么意思?完全 nan 列和“空”列之间有区别吗?
-
@HenryEcker Null 表示单元格是否使用“null”进行硬编码,而单元格为“”时为空
-
谢谢,但如果它是一个可以复制和粘贴的示例就更好了。尝试建立一个帮助门槛尽可能低的例子:)