Extract month, year and week from date

PHOTO EMBED

Thu Apr 20 2023 09:31:52 GMT+0000 (Coordinated Universal Time)

Saved by @jmbenedetto #python

df_cart['ano_prev_rec']=df_cart['data_prevista_recebimento'].dt.year.astype('str')
df_cart['mes_prev_rec']=df_cart['data_prevista_recebimento'].dt.month.map("{:02}".format).astype('str')
df_cart['ano_mes_prev_rec']=df_cart['ano_prev_rec']+df_cart['mes_prev_rec']
content_copyCOPY