title: How do I check if all values in a column of a pandas dataframe are equal?
body: <p>I have a dataframe like this</p>
  
  <pre><code>  name data result 
  0  x    100
  1  x    100
  2  x    100
  3  x    100
  4  x    100
  5  y    100
  6  y    90
  7  y    90
  8  y    100
  9  y    85
  </code></pre>
  
  <p>I want to check whether each group in the <code>name</code> column have the same value in the <code>data</code> column.</p>
  
  <p>So for each <code>x</code> group, if the corresponding <code>data</code> value are all equal, write <code>full</code> in the <code>result</code> column. If the values for a group not are all equal, write <code>nearly</code> in the <code>result</code> column.</p>
  
  <p>I have tried grouping the dataframe:</p>
  
  <pre><code>dfx = df.groupby('name')
  dfx = dfa.get_group('x')
  </code></pre>
  
  <p>but it doesn't really help in checking if each value is the same, write in the <code>result</code> column.</p>
  
  <p>I have tried creating a function that will check for unique values</p>
  
  <pre><code>def check_identicals(row):
      if(df.sent.nunique() == 1):
          print('Full')
  </code></pre>
  
  <p>The idea here is to then apply that function to each row and write the output in the <code>result</code> column.</p>
  
  <p>Ideal output:</p>
  
  <pre><code>   name data result 
  0  x    100   full
  1  x    100   full
  2  x    100   full
  3  x    100   full
  4  x    100   full
  5  y    100   nearly
  6  y    90    nearly
  7  y    90    nearly
  8  y    100   nearly
  9  y    85    nearly
  </code></pre>