I want to use date_posted column to create a new column called ad_placed, featuring the Day of the week, month, and year. What is the proper format? My code is running weekdays as numbers, I want Sunday-Saturday. I also want to add month&date and year. I'm hoping to have it print like Monday March 20, 2020
data['ad_placed'] = pd.DatetimeIndex(data['date_posted']).weekday
data['ad_placed']
CodePudding user response:
Do this:
df["ad_placed"] = pd.DatetimeIndex(df.date_posted).strftime("%A %B %d, %Y")