pandas datetinme format code example
Example 1: format date field in pandas
df['date'] = pd.to_datetime(df["date"].dt.strftime('%Y-%m'))
Example 2: apply format to pandas datetime column
formatted_df = df["Date"].dt.strftime("%m/%d/%y")
df['date'] = pd.to_datetime(df["date"].dt.strftime('%Y-%m'))
formatted_df = df["Date"].dt.strftime("%m/%d/%y")