python - Extracting the first day of month of a datetime type column in pandas - Stack Overflow

PHOTO EMBED

Wed May 12 2021 08:51:03 GMT+0000 (Coordinated Universal Time)

Saved by @arielvol #python

     df['month']=df['purchase_date'].apply(lambda x : x.replace(day=1))
content_copyCOPY

https://stackoverflow.com/questions/45304531/extracting-the-first-day-of-month-of-a-datetime-type-column-in-pandas