title: Convert date string YYYY-MM-DD to YYYYMM in pandas
body: <p>Is there a way in pandas to convert my column date which has the following format '1997-01-31' to '199701', without including any information about the day?</p>
  
  <p>I tried solution of the following form:</p>
  
  <p><code>df['DATE'] = df['DATE'].apply(lambda x: datetime.strptime(x, '%Y%m'))</code></p>
  
  <p>but I obtain this error : 'ValueError: time data '1997-01-31' does not match format '%Y%m''</p>
  
  <p>Probably the reason is that I am not including the day in the format. Is there a way better to pass from YYYY-MM_DD format to YYYYMM in pandas?</p>