title: Making decisions based on the times of datetime in a dataframe
body: <p>I am new to programming and python. After many hours of research I want to ask the community for help. I want to use data to backtest a trading strategy based on the beginning of the London Session.</p>
  <p>I have a dataframe:</p>
  <pre><code>&lt;class 'pandas.core.frame.DataFrame'&gt;
  RangeIndex: 28766 entries, 0 to 28765
  Data columns (total 6 columns):
  | #  | Column | Non-Null Count  |Dtype   |      
  |--- |------ |--------------  |----- |        
  | 0  |Time   |28766 non-null  |datetime64[ns]|
  | 1  |Open   |28766 non-null  |float64 |
  | 2 |...|
  
  |    |Time                  |Open    | High   | Low    |Close   |Volume  |
  |--- |--------------------- |------- |------- |------- |------- | ------|
  |8   |2017-05-23 08:00:00   |2180.7  |2187.2  |2139.2  | 2170.2 | 97.0  |
  </code></pre>
  <p>And now I want to define a function which recognizes every row with 08:00 GMT in it:</p>
  <pre><code>def LondonSession(df):
  df = df.copy()
  for t in df['Time']:
      if df[df['Time'].dt.hour == (8)]:
          df['StopLoss'] = technicals(df)['atr'] * (-1)
          df['TakeProfit'] = technicals(df)['atr'] * (2)
      else: 
          df['StopLoss'] = technicals(df)['atr'] * (0)
          df['TakeProfit'] = technicals(df)['atr'] * (0)
  return df
  </code></pre>
  <p><code>print(LondonSession(df)[0:10])</code></p>
  <p>Unfortunately I have no more ideas how to solve the error messages:</p>
  <pre><code>ValueError                                Traceback (most recent call last) Input In [204], in &lt;module&gt;
        9             df['TakeProfit'] = technicals(df)['atr'] * (0)
       10     return df
  ---&gt; 11 print(LondonSession(df)[0:10])
  
  Input In [204], in LondonSession(df)
        2 df = df.copy()
        3 for t in df['Time']:
  ----&gt; 4     if df[df['Time'].dt.hour == (8)]:
        5         df['StopLoss'] = technicals(df)['atr'] * (-1)
        6         df['TakeProfit'] = technicals(df)['atr'] * (2)
  
  File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\generic.py:1537, in NDFrame.__nonzero__(self)    1535 @final    1536 def
  __nonzero__(self):
  -&gt; 1537     raise ValueError(    1538         f&quot;The truth value of a {type(self).__name__} is ambiguous. &quot;    1539         &quot;Use a.empty, a.bool(), a.item(), a.any() or a.all().&quot;    1540     )
  
  ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  <p>Any input is recommended.
  Thanks in advance!</p>