Groupby ValueError: The truth value of a DataFrame is ambiguous. 
When iterating through several dimension columns and doing a groupby function, it often works. However, for certain columns it will not and instead I get an error. The error is: 

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

The only thing different about these specific columns is that they are unique. However, we won't often be aware if they are unique. I'm hoping this isn't the issue and if it is, is there a work around?

Thanks!

Below is the full traceback.

---

ValueError                                Traceback (most recent call last)
<ipython-input-113-07075c74519b> in <module>()
----> 1 df_grp = df.groupby('post_id').sum()

/Users/Dev/anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc in groupby(self, by, axis, level, as_index, sort, group_keys, squeeze)
   3157         axis = self._get_axis_number(axis)
   3158         return groupby(self, by=by, axis=axis, level=level, as_index=as_index,
-> 3159                        sort=sort, group_keys=group_keys, squeeze=squeeze)
   3160 
   3161     def asfreq(self, freq, method=None, how=None, normalize=False):

/Users/Dev/anaconda/lib/python2.7/site-packages/pandas/core/groupby.pyc in groupby(obj, by, *_kwds)
   1197         raise TypeError('invalid type: %s' % type(obj))
   1198 
-> 1199     return klass(obj, by, *_kwds)
   1200 
   1201 

/Users/Dev/anaconda/lib/python2.7/site-packages/pandas/core/groupby.pyc in **init**(self, obj, keys, axis, level, grouper, exclusions, selection, as_index, sort, group_keys, squeeze)
    386         if grouper is None:
    387             grouper, exclusions, obj = _get_grouper(obj, keys, axis=axis,
--> 388                                                     level=level, sort=sort)
    389 
    390         self.obj = obj

/Users/Dev/anaconda/lib/python2.7/site-packages/pandas/core/groupby.pyc in _get_grouper(obj, key, axis, level, sort)
   2152             in_axis, name = False, None
   2153 
-> 2154         if is_categorical_dtype(gpr) and len(gpr) != len(obj):
   2155             raise ValueError("Categorical dtype grouper must have len(grouper) == len(data)")
   2156 

/Users/Dev/anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc in **nonzero**(self)
    712         raise ValueError("The truth value of a {0} is ambiguous. "
    713                          "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
--> 714                          .format(self.**class**.**name**))
    715 
    716     **bool** = **nonzero**

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
