title: unable to eliminate 'NoneType' object is not iterable error in DataFrame
body: <p>I'm an old SAS user new to Python. SO has several examples of why this error occurs.  <a href="https://stackoverflow.com/questions/3887381/typeerror-nonetype-object-is-not-iterable-in-python">
  Here</a> for example.</p>
  
  <p>I want to eliminate this source of error.  I'm working with a large dataframe created with the read_cvs reader.</p>
  
  <pre><code>print(df.size, df.shape, df.ndim)
  7202952 (266776, 27) 2
  </code></pre>
  
  <p>Date and Time are objects:</p>
  
  <pre><code>print(df.Date.dtype)
  print(df.Time.dtype)
  object
  object
  </code></pre>
  
  <p>So I convert them to datetime:</p>
  
  <pre><code>df['Date'] = pd.to_datetime(df['Date'])
  df['Time'] = pd.to_datetime(df['Time'])
  </code></pre>
  
  <p>Set df.Date as the index:</p>
  
  <pre><code>df.set_index('Date', inplace=True)
  </code></pre>
  
  <p>Drop na's:</p>
  
  <pre><code>df = df.dropna()
  print(df.shape)
  (266752, 26)
  </code></pre>
  
  <p>And verify there are 24 fewer rows than indicated above:</p>
  
  <p>Count the number of accident reports on Dec. 25, 2015 with:</p>
  
  <pre><code>print(len(df.loc['2015-07-04']))
  625
  </code></pre>
  
  <p>Good so far. Now count the number of accident reports between Dec. 25, 2015 and Dec 31, 2015 with:</p>
  
  <pre><code>print(len(df.loc[['2015-12-25','2015-12-26']]))
  </code></pre>
  
  <p>which returns:</p>
  
  <pre><code>TypeError: 'NoneType' object is not iterable
  </code></pre>
  
  <p>I've run out of ideas, so I check the index with:</p>
  
  <pre><code>print(df.index)
  DatetimeIndex(['2015-01-09', '2015-01-09', '2015-02-23', '2015-02-23',
             '2015-02-23', '2015-02-11', '2015-02-11', '2015-02-23',
             '2015-02-23', '2015-04-18',
             ...
             '2015-08-30', '2015-11-29', '2015-11-29', '2015-11-29',
             '2015-07-26', '2015-07-26', '2015-12-31', '2015-07-28',
             '2015-07-28', '2015-07-15'],
            dtype='datetime64[ns]', name='Date', length=266752, freq=None)
  </code></pre>
  
  <p>I would like to understand what is the source of this error.  Other thoughts are: perhaps sorting df.Date would help, given Date is 'out-of-order' and with multiple rows for each day.  </p>
  
  <p>I assumed that dropping the 24 rows would solve the problem.  And I also assume that since the DataFrame contains no objects, I would not have any None objects.</p>
  
  <pre><code>df.get_dtype_counts()
  datetime64[ns]     1
  int64             25
  dtype: int64
  </code></pre>
  
  <p>Where do I go from here?</p>