I am new to Python and struggle with a seemingly simple problem. I am trying to change the format of the DateTimeIndex to show only years and months. I am still returned the original format (YYYY-MM-DD). Thank you in advance.
from numpy import array
import pandas as pd
import quandl
import numpy as np
import matplotlib.pyplot as plt
new_orders=quandl.get("ISM/MAN_NEWORDERS.5")
df = quandl.get("USTREASURY/YIELD", collapse="monthly")
#plt.plot(new_orders[4])
#plt.show()
df2=pd.DataFrame(df['10 YR'])
df2.index.strftime('%Y-%m')
print(df2.index)