Extracting the hour from a datetime64[ns] variable
<p>I have a column that I've converted to datetime using pandas so it's now in the format datetime64.</p>

<pre><code>LOCAL_TIME_ON 
2014-06-21 15:32:09
2014-06-07 20:17:13
</code></pre>

<p>I want to extract the hour to a new column. The only thing I've found that works is below, however, I get a SettingWithCopyWarning. Does anyone have a cleaner way I can do this?</p>

<pre><code>TRIP_INFO_TIME['TIME_HOUR'] = pd.DatetimeIndex(TRIP_INFO_TIME['LOCAL_TIME_ON']).hour.astype(int)
</code></pre>

<blockquote>
<pre><code>C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.1.4\helpers\pydev\pydevconsole.py:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  '''
</code></pre>
</blockquote>