按疫苗类别接种剂次排序后重新赋值
def hbv(self):
df = self._df
df.query("vaccination_code in ['0201', '0202', '0203']", inplace=True)
df['vaccine_name'] = '乙肝疫苗'
df = df.groupby('id_x', group_keys=False).apply(
lambda x: x.sort_values(by='vaccination_date', ascending=True)
.assign(jc=range(1, len(x) + 1))
.reset_index(drop=True)
)
return df
bind_rows(jzjl,jzjl2) %>%
mutate(mc = if_else(mc %in% c('麻腮风疫苗', '麻风疫苗'), '含麻疹成分疫苗', mc)) %>%
filter(mc=='含麻疹成分疫苗') %>%
group_by(grda_code) %>%
arrange(jz_sj) %>%
mutate(jz_zc = row_number()) ->tmp1
评论
发表评论