I have the following dataframe
Country Name Code Signed Index
0 CZ Paulo 3 x 1
1 AE Paulo Yes None 1
2 AE Paulo Yes None 2
3 AE Paulo 1 Yes 5
4 CZ Paulo None None 6
5 DK Paulo Yes None 9
6 DK Paulo None None 20
7 PT Paulo 2 Yes 20
8 PT Paulo 1 Yes 22
I need three new columns after grouping by country
- count the missing values in
CodeandSignedcolumn - total of rows that have both values filled
- total of rows that have the same Country value
- point the rows where we have any of those values blank per Country (list or non list format) using the column "Index" as reference
If any of the Countries have all their Code and Signed rows filled, remove it from the dataframe.
In this case, it would return this dataframe:
Country Total_Blanks_on_Code Total_Blanks_on_Signed Total_of_rows_with_both_values_filled Total_of_rows_of_the_Country Rows with any blank
0 CZ 1 1 None 2 6
1 AE 2 0 1 3 [1,2]
2 DK 2 1 None 2 [9,20]
Thank you for your help!
