pyspark.pandas.groupby.GroupBy.all

GroupBy.all(skipna: bool = True) → FrameLike[source]

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

Parameters
skipnabool, default True

Flag to ignore NA(nan/null) values during truth testing.

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
>>> df.groupby('A').all(skipna=False).sort_index()  
       B
A
1   True
2  False
3  False
4  False
5  False