I need to convert the date to Day, Month and Year, I tried some alternatives but I was unsuccessful.
import pandas as pd
df = pd.read_excel(r"C:\__Imagens e Planilhas Python\Instagram\Postagem.xlsx")
print(df)
I need the date to be the same as the image below
CodePudding user response:
it's very confusing because you're using 2 different format between the image and the expected result (and you write you want the same).
clarify that data is a date with:
df['data']= = pd.to_datetime(df['data'])
once you have this - just change the format with:
my_format = '%m-%d-%Y'
df['data'] = df['data'].dt.strftime(my_format)