In [7]:
df['OrderPeriod']=df['OrderDate'].dt.strftime('%Y-%m')
df.head()
Out[7]:
OrderId OrderDate UserId OrderPeriod
0 262 2009-01-11 47 2009-01
1 278 2009-01-20 47 2009-01
2 294 2009-02-03 47 2009-02
3 301 2009-02-06 47 2009-02
4 302 2009-02-06 47 2009-02