如果记录在快照中只出现一次,请添加一个虚拟行

2024-10-01 09:38:45 发布

您现在位置:Python中文网/ 问答频道 /正文

   YY_MM_CD customerid pol_no   type   WE   WP
2019-07  15680    1313145    new    3     89
2020-01  14672    1418080    renwd  -8    223
2019-01  15681    1213143    new    4      8
2019-01  15683    1213344    new    -6       3
2019-03  14678    1418280    renwd  -66     -7

假设我正在为2019-20年的快照拍摄一年的数据,我需要为在一年的时间范围内未结婚且是新客户的客户id创建虚拟记录 df1(用于客户id 15681)

YY_MM_CD customerid pol_no   type   WE   WP
2019-07  15680    1313145    new    3     89
2020-01  14672    1418080    renwd  -8    223
2019-01  15681    1213143    new    4      8
2020-01  15681    1213143    new    0       0
2019-03  14678    1418280    renwd  -66     -7

Tags: 数据noidnew客户typecd快照