title: Combining columns using pandas
body: <p>I am trying to combine date and time columns of a csv file and convert them to timestamp using pandas.</p>
  
  <p>Here is a sample of my csv file when read into a dataframe </p>
  
  <p><a href="https://i.stack.imgur.com/iaXIX.png" rel="nofollow noreferrer">Dataframe after reading</a></p>
  
  <pre><code>Id     Station        Month       Parameter    Date        From       To
  1.0    ANANDVIHAR     Dec         ?PM2.5       2015-12-01  ?00:00:00  ?00:59:00
  </code></pre>
  
  <p>The Following Code:-</p>
  
  <pre><code>df['DateTime'] = df.apply(lambda row: datetime.datetime.strptime(row['Date']+ ':' + row['From'], '%Y.%m.%d:%H:%M:%S'), axis=1)
  </code></pre>
  
  <p>Is giving the following error:-</p>
  
  <pre><code>Traceback (most recent call last):
  
    File "project101.py", line 36, in &lt;module&gt;
      df['DateTime'] = df.apply(lambda row: datetime.datetime.strptime(row['Date']+ ':' + row['From'], '%Y.%m.%d:%H:%M:%S'), axis=1)
  
    File "c:\Python27\lib\site-packages\pandas\core\frame.py", line 4133, in apply
      return self._apply_standard(f, axis, reduce=reduce)
  
   File "c:\Python27\lib\site-packages\pandas\core\frame.py", line 4229, in _apply_standard
      results[i] = func(v)
  
    File "project101.py", line 36, in &lt;lambda&gt;
      df['DateTime'] = df.apply(lambda row: datetime.datetime.strptime(row['Date']+ ':' + row['From'], '%Y.%m.%d:%H:%M:%S'), axis=1)
  
    File "c:\Python27\lib\_strptime.py", line 332, in _strptime
      (data_string, format))
  
  ValueError: ("time data '2015-12-01:\\xa000:00:00' does not match format '%Y.%m.%d:%H:%M:%S'", u'occurred at index 0')
  </code></pre>