df = sales.groupby([sales.date.apply(lambda x: x.strftime('%Y-%m')),'id',]).sum().reset_index()
df = df[['date','id','yr_built']]
df = df.pivot_table(index=['id'], columns='date',values='yr_built',fill_value=0).reset_index()
df.head()
AttributeError: 'str' object has no attribute 'strftime'......