Может быть, вам нужен также день недели. Вы можете попробовать следующим образом:
from datetime import datetime
df1 = pd.DataFrame([['201710', 2], ['201715', 3], ['201720', 4]], columns = ['period' ,'val'])
#Add Sunday as day of the week
df1['period'] = df1['period'].astype(str) + '0'
df1['period'] = df1['period'].apply(lambda x: datetime.strptime(x, "%Y%W%w"))
df1.set_index('period', inplace=True)
print (df1)
Выход:
val
date
2017-03-12 2
2017-04-16 3
2017-05-21 4
Или:
df1['period'] = df1['period'].astype(str) + '0'
df1['period'] = pd.to_datetime(df1['period'], format='%Y%W%w')
df1.set_index('period', inplace=True)
И он имеет тот же вывод