title: When converting Date entry in pandas, how to ignore empty values?
body: <p>I have an excel with some date entries as below.</p>
  
  <pre><code>   Case Number    Status    Date/Time Opened  Date/Time Resolved  Date/Time Closed
               1    Closed    2/1/2017 7:15 AM   2/1/2017 10:44 AM  2/21/2017 11:50 AM 
               2  Assigned    2/2/2017 2:09 PM                       
               3  Resolved   2/8/2017 10:32 AM   9/11/2017 8:49 PM   
               4    Closed   8/27/2018 6:00 AM  10/15/2018 9:10 AM  10/15/2018 9:10 AM 
               5  Resolved  12/26/2018 3:25 PM   2/11/2019 9:08 AM   
  </code></pre>
  
  <p>Initially I'm converting them from the above pattern to <code>$year-$mm-$dd</code>.</p>
  
  <pre><code>   Case Number    Status Date/Time Opened Date/Time Resolved Date/Time Closed
               1    Closed       2017-02-01         2017-02-01       2017-02-21
               2  Assigned       2017-02-02                NaN              NaN
               3  Resolved       2017-02-08         2017-09-11              NaN
               4    Closed       2018-08-27         2018-10-15       2018-10-15
               5  Resolved       2018-12-26         2019-02-11              NaN
  </code></pre>
  
  <p>With these converted dates, I'm trying extract month and year in the format <code>$mon $year</code>.</p>
  
  <p>I'm using following code to extract month and year.</p>
  
  <pre class="lang-py prettyprint-override"><code>df['Month Opened'] = pd.to_datetime(df["Date/Time Opened"]).map(lambda x: calendar.month_abbr[x.month] + " " + str(x.year))
  </code></pre>
  
  <p>When I have applied this formula with 'Date/Time Opened', I can see that it works as below.</p>
  
  <pre><code>   Case Number    Status Date/Time Opened Date/Time Resolved Date/Time Closed  Month Opened  
               1    Closed       2017-02-01         2017-02-01       2017-02-21      Feb 2017 
               2  Assigned       2017-02-02                NaN              NaN      Feb 2017
               3  Resolved       2017-02-08         2017-09-11              NaN      Feb 2017
               4    Closed       2018-08-27         2018-10-15       2018-10-15      Aug 2018
               5  Resolved       2018-12-26         2019-02-11              NaN      Dec 2018
  </code></pre>
  
  <p>Here's my complete code - <a href="http://tpcg.io/X5S8Pe" rel="nofollow noreferrer">http://tpcg.io/X5S8Pe</a></p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  import calendar
  
  CaseDetails = {
          'Case Number':          [1, 2, 3, 4, 5],
          'Status':               ['Closed',              'Assigned',         'Resolved',          'Closed',              'Resolved'],
          'Date/Time Opened':     ['2/1/2017 7:15 AM',    '2/2/2017 2:09 PM', '2/8/2017 10:32 AM', '8/27/2018 6:00 AM',   '12/26/2018 3:25 PM'],
          'Date/Time Resolved':   ['2/1/2017 10:44 AM',   '',                 '9/11/2017 8:49 PM', '10/15/2018 9:10 AM',  '2/11/2019 9:08 AM'],
          'Date/Time Closed':     ['2/21/2017 11:50 AM',  '',                 '',                  '10/15/2018 9:10 AM',  '']
      }
  
  df = pd.DataFrame(CaseDetails,columns= ['Case Number', 'Status', 'Date/Time Opened', 'Date/Time Resolved', 'Date/Time Closed'])
  
  df['Date/Time Opened'] = pd.to_datetime(df['Date/Time Opened']).dt.date
  df['Date/Time Resolved'] = pd.to_datetime(df['Date/Time Resolved']).dt.date
  df['Date/Time Closed'] = pd.to_datetime(df['Date/Time Closed']).dt.date
  
  print (df)
  
  df['Month Opened'] = pd.to_datetime(df["Date/Time Opened"]).map(lambda x: calendar.month_abbr[x.month] + " " + str(x.year))
  df['Month Closed'] = pd.to_datetime(df["Date/Time Closed"]).map(lambda x: calendar.month_abbr[x.month] + " " + str(x.year))
  
  print (df)
  </code></pre>
  
  <p>As expected, my code converted entries under 'Date/Time Opened' to the desired format. When tried converting other 2 dates columns, I get the following error.</p>
  
  <pre><code>Traceback (most recent call last):
    File "main.py", line 21, in &lt;module&gt;
      df['Month Closed'] = pd.to_datetime(df["Date/Time Closed"]).map(lambda x: calendar.month_abbr[x.month] + " " + str(x.year))
    File "/usr/lib64/python2.7/site-packages/pandas/core/series.py", line 2158, in map
      new_values = map_f(values, arg)
    File "pandas/_libs/src/inference.pyx", line 1569, in pandas._libs.lib.map_infer (pandas/_libs/lib.c:66440)
    File "main.py", line 21, in &lt;lambda&gt;
      df['Month Closed'] = pd.to_datetime(df["Date/Time Closed"]).map(lambda x: calendar.month_abbr[x.month] + " " + str(x.year))
    File "/usr/lib64/python2.7/calendar.py", line 56, in __getitem__
      funcs = self._months[i]
  TypeError: list indices must be integers, not float
  </code></pre>
  
  <p>I wanted to know is there a way to covert the columns with empty values?</p>