0
The following code groups my DF by some columns
f0219.groupby(['Matricula', 'Nome', 'Rubrica', 'Valor', 'CodigoRendimentoDesconto', 'Tiporubrica']).Rubrica.count()
and counts how many times the Rubric column appears in each grouping. The result of this code can be checked in the image below:
I want, if the Tiporubrica column is equal to "2", it adds what is in the Value column, and displays the result of that sum in a third column. Also, I realized that when running the above groupby command, the result is not displayed on a dataframe, and I would like it to be, as I intend to work on the result as a dataframe.