title: Creating a DataFrame in Pandas using logical and operator
body: <p>I have a pandas Datarame with some columns and I first wanted to print only those rows whose values in a particular column is less than a certain value. So I did:</p>
  
  <pre><code>df[df.marks &lt; 4.5]
  </code></pre>
  
  <p>It successfully created the dataframe, now I want to add only those columns whose values are in a certain range, so I tried this:</p>
  
  <pre><code>df[(df.marks &lt; 4.5 and df.marks &gt; 4)]
  </code></pre>
  
  <p>but it's giving me an error:</p>
  
  <pre><code>712         raise ValueError("The truth value of a {0} is ambiguous. "    
  713                          "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
  --&gt; 714                          .format(self.__class__.__name__))
  715 
  716     __bool__ = __nonzero__    
  ValueError: The truth value of a Series is ambiguous. Use a.empty,
  a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  
  <p>How do I resolve this? And initially I also thought that it would iterate through all the rows and check the truth value and then add the row in the dataframe, but it seems like this isn't the case, if so how does it add the row in the dataframe?</p>