Python_if判断&函数

网友投稿 858 2022-11-16

Python_if判断&函数

Python_if判断&函数

Python_if判断&函数

#if判断,运用函数函数进行判断def is_firstlastone(x): if x==0: return 1 elif x>0: return 0 else: return -1 #those only receive once t3.this_month_user_receive_same_coupon_lastone = t3.this_month_user_receive_same_coupon_lastone.apply(is_firstlastone)t3.this_month_user_receive_same_coupon_firstone = t3.this_month_user_receive_same_coupon_firstone.apply(is_firstlastone)t3 = t3[['user_id','coupon_id','date_received','this_month_user_receive_same_coupon_lastone','this_month_user_receive_same_coupon_firstone']]

打标签

def is_firstlastone(x): if x==0: return 1 elif x>0: return 0 else: return -1 #those only receive once t3.this_month_user_receive_same_coupon_lastone = t3.this_month_user_receive_same_coupon_lastone.apply(is_firstlastone)t3.this_month_user_receive_same_coupon_firstone = t3.this_month_user_receive_same_coupon_firstone.apply(is_firstlastone)

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:JPA设置默认字段及其长度详解
下一篇:pyspark_统计行数_过滤
相关文章

 发表评论

暂时没有评论,来抢沙发吧~