pyspark.pandas.groupby.GroupBy.all

GroupBy.all() → FrameLike[source]

Returns True if all values in the group are truthful, else False.

Examples

>>> df = ps.DataFrame({'A': [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],
...                    'B': [True, True, True, False, False,
...                          False, None, True, None, False]},
...                   columns=['A', 'B'])
>>> df
   A      B
0  1   True
1  1   True
2  2   True
3  2  False
4  3  False
5  3  False
6  4   None
7  4   True
8  5   None
9  5  False
>>> df.groupby('A').all().sort_index()  
       B
A
1   True
2  False
3  False
4   True
5  False