Please help to create ranking that excludes values = 0, null, NaN for the below df,
Input:
df = pd.DataFrame(data={'Group1': ['A', 'A', 'A',
'B', 'C','D'],
'Group2': ['A1', 'A2', 'A3',
'B1', 'B2','D1'],
'Number': [3, 2, 4, 0, np.nan,'']
Expected result:
Group1 Group2 Number Rank
A A1 3 2
A A2 2 1
A A3 4 3
B B1 0
C B2 NaN
D D1
Similar post but does not show on excluding zero, null, nan Ranking order per group in Pandas