title: How to fix "The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()" in Python Pandas?
body: <p>I have a dataset where I have two time stamp columns, one is the start time and the other is the end time. I have calculated the difference and also stored it in another column in the dataset. Based on the difference column of the dataset, I want to fill in a value in another column. I am using for loop and if else for the same but upon execution, the error "The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()" appears </p>
  
  <pre><code>   Time_df = pd.read_excel('filepath')
  
     print(Time_df.head(20))
  
     for index, rows in Time_df.head().iterrows():
           if(Time_df["Total Time"] &lt; 6.00 ):
               Time_df["Code"] = 1
  
     print(Time_df.head(20))  
  </code></pre>
  
  <p>In Total Downtime, wherever a less than 6 is encountered, it will put 1 in the column code. However, I get the error as stated in the question.</p>