how can I go from a dataframe with the following structure:
col1 | col2 | col3 |
---|---|---|
TRUE | FALSE | TRUE |
TRUE | FALSE | FALSE |
TRUE | TRUE | TRUE |
TRUE | TRUE | FALSE |
TRUE | FALSE | TRUE |
to a result like this, without using pandas only pyspark.
x | TRUE | FALSE |
---|---|---|
col1 | 5 | 0 |
col2 | 2 | 3 |
col3 | 3 | 2 |
NOTE THAT THE TRUE/FALSE COLUMN IS A COUNT OF THE NUMBER OF TRUE/FALSE THAT EXIST IN EACH COLUMN
Thanks!!